Very often it happens to me to find pieces or full videos on Reddit that I would like to redirect to someone directly, I mean to share the content and not to share the link to the post. But it is not possible in a simple way, or at least I did not succeed at it until today.
Web inspector console and FFmpeg can help us on Reddit
First, find a post with a video that you like. Second, open it with Firefox or Chrome or any other browser with built-in development tools. Third, follow the following steps.
I assume you’re using Firefox (but it’s ok also with other browsers), so open the page with the video you like in Firefox. For example, I’m using this amazing owls video: https://www.reddit.com/r/youseeingthisshit/comments/a3r1xx/wtf_is_this_thing_im_looking_at/.
Open options in the browser and go to Web Developer > Inspector or use CTRL + SHIFT + C combination or (faster) use the right click on the video and select Inspect Element (Q). You can also use the Web Developer > Page Source or the CTRL + U.
Now, in both ways, find the following strings, manually or with CTRL + F:
You get something like this:
<source src="https://v.redd.it/7drl8aqxgp221/HLSPlaylist.m3u8" type="application/vnd.apple.mpegURL"/>
Open a terminal window and use what we have found, so digit:
$ ffmpeg -i "https://v.redd.it/7drl8aqxgp221/HLSPlaylist.m3u8" reddit-owls.mp4
And you get the Reddit video in .mp4 format, but you can also use different video formats, like for example the wide-spreading web video format .webm.
What is FFmpeg?
FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
You can install FFmpeg on your system as it is Linux, macOS or Windows, just download it from the official website:
- Linux Packages – http://ffmpeg.org/download.html#build-linux
- macOS Packages – http://ffmpeg.org/download.html#build-mac
- Windows Packages – http://ffmpeg.org/download.html#build-windows
For our favorite Linux distros, we can use the official precompiled software:
- Fedora on RPM Fusion – https://rpmfusion.org
- openSUSE Software – https://software.opensuse.org/package/ffmpeg
- Ubuntu LP Package – https://launchpad.net/ubuntu/+source/ffmpeg
The FFmpeg documentation is very clear and complete, so you just need to read it to understand how to use all the power of this software, but if you want some ‘ready to go’ commands here there is the list:
$ ffmpeg -i video.mp4 #this command (i for info) shows all the technical detail of the file
$ ffmpeg -formats #this command show the list of all the supported file formats
$ ffmpeg -i video.avi video.mp4 #this convert the avi file to the mp4 format
$ ffmpeg -i video.mp4 -vn audio.mp3 #this command converts a video file to an audio format
$ ffmpeg -i wavaudio.wav -vn -ar 44100 -ac 2 -ab 192k -f mp3 mp3audio.mp3 #this command converts a wav audio file to a mp3 audio file
$ ffmpeg -i 4Kvideo.mp4 -filter:v scale=1920:1080 -c:a copy fullHDvideo.mp4 #this command scales a 4K video to a FHD video
$ ffmpeg -i videowithaudio.mp4 -an videowithoutaudio.mp4 #this command removes the audio track from the video file
$ ffmpeg -i 43video.mp4 -aspect 16:9 169video.mp4 #this command converts the aspect ratio of the video
FFmpeg is a real swiss-knife for audio and video file. The results are always wonderful with top quality files produced and it’s really easy to use. We suggest you to start learning the basic and do some experiments by your own, just discover it and we are sure that you’ll love it!