Skip to main content
279 votes

How can I reduce a video's size with ffmpeg?

You mentioned wanting to reduce the file size to fit more videos on a mobile device, which is my use case as well.  All the answers here are for reducing the compression quality, but nobody has ...
georgiecasey's user avatar
  • 2,981
131 votes

Merge two video clips into one, placing them next to each other

To be honest, using the accepted answer resulted in a lot of dropped frames for me. However, using the hstack filter_complex produced perfectly fluid output: ffmpeg -i left.mp4 -i right.mp4 -...
Albus Dumbledore's user avatar
129 votes

How can I reduce a video's size with ffmpeg?

I tested most of the other proposed answers to this question. The test data conclusions are below. These are the proposed answers that I tested: (BR) Modify the bitrate, using: ffmpeg -i $infile -b $...
John Pankowicz's user avatar
114 votes

How can I reduce a video's size with ffmpeg?

Note that it seems that ffmpeg already performs some optimization when ran without options, so before trying to use settings you don't understand or deciding to explicitly lose information, give a try ...
Skippy le Grand Gourou's user avatar
29 votes
Accepted

How to recover a broken mp4 file: moov atom not found

You can try and use Untrunc to fix the file. Restore a damaged (truncated) mp4, m4v, mov, 3gp video. Provided you have a similar not broken video. you may need to compile it from source, but there ...
Rabin's user avatar
  • 3,991
28 votes
Accepted

Multiple /dev/video for one physical device

The second device provides metadata about the video data from the first device. The new devices were introduced by this patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/...
James Henstridge's user avatar
23 votes

How can I reduce a video's size with ffmpeg?

I compressed a 40-minute HD video presentation from 505MB to 183MB That's like going from 100MB → 36MB. Original video was HD and output was almost zero noticeable difference. It's a video file "...
Jake Berger's user avatar
22 votes

How do I watch my webcam's feed on Linux?

ffplay /dev/video0 is one of the simpler methods, and will work provided you have ffmpeg installed. To install, use sudo apt install ffmpeg.
Henry Wilson's user avatar
19 votes

How can I change my webcam's power line frequency setting?

On the command line, you can set the uvcvideo driver's power line frequency setting to the 50 Hz value with: v4l2-ctl --set-ctrl=power_line_frequency=1 If your webcam is not /dev/video0, add a -d /...
telcoM's user avatar
  • 114k
17 votes
Accepted

How to reduce the size of a video to a target size?

@philip-couling's answer is close but missing several pieces: The desired size in MB needs to be multiplied by 8 to get bit rate For bit rates, 1Mb/s = 1000 kb/s = 1000000 b/s; the multipliers aren't ...
tobek's user avatar
  • 438
16 votes

Re-encoding video library in x265 (HEVC) with no quality loss

I've recently gone through the trouble of Transcoding my whole video catalog over to HEVC. I use https://github.com/FallingSnow/h265ize with the following settings. h265ize -v -m medium -q 20 -x --no-...
Ashleigh-Paul Charlesworth's user avatar
15 votes

How to do I convert an animated gif to an mp4 or mv4 on the command line?

A side note: the important thing is to specify -pix_fmt yuv420p lest your video might seem a black rectangle in various tools: $ ffmpeg -i animated.gif -pix_fmt yuv420p output.mp4 References Why won'...
beefeather's user avatar
14 votes

How can you download 4k youtube videos in mp4 using youtube-dl?

You can find the available mp4 resolutions available for a video with: youtube-dl --list-formats https://youtu.be/LXb3EKWsInQ | grep mp4 ... 401 mp4 3840x2160 2160p60 18167k , av01.0....
Hugh's user avatar
  • 387
13 votes
Accepted

How to restart a failed amdgpu kernel module

As @Chris Stryczynski says, sudo cat /sys/kernel/debug/dri/N/amdgpu_gpu_recover is the correct way to reload the amdgpu kernel module, or you can start your system with amdgpu.gpu_recovery=1 kernel ...
Dávid Bíró's user avatar
12 votes

How to significantly lower a video file size with ffmpeg without quality loss?

I had a pretty good experience with the h265 codec. The output videos were between 2-8x smaller in size, without any noticeable loss in quality. ffmpeg -i input.mkv -c:v libx265 -vtag hvc1 -c:a copy ...
mashuptwice's user avatar
  • 1,484
11 votes

How do I watch my webcam's feed on Linux?

Or you can try mpv command mpv /dev/video0
hungptit's user avatar
  • 211
11 votes

How to do I convert an animated gif to an mp4 or mv4 on the command line?

If you want to make the output in "n loops", look at this solution in one shot So, let's convert a normal.gif to loop.mp4 for 2 loops movie example: ffmpeg -stream_loop 2 -i normal.gif loop.gif -y;...
PYK's user avatar
  • 221
11 votes

How to recover a broken mp4 file: moov atom not found

Solution provided here (https://github.com/ponchio/untrunc) solved my problem! I run it as a Docker container. Here my steps: Install Docker (in case you don't have it yet) Clone the repository: ...
Alexandre Andrade's user avatar
11 votes

How can I watch an encrypted Blu-ray on a Linux desktop?

There is no official commercial Blu-ray player for Linux. Linux users have to use open-source libraries capable of handling the DRM schemes that protect these disc contents. This is legal in most ...
Lutz Willek's user avatar
10 votes

How can I download a video from an M3U8 file?

The movie can be easily downloaded using the FFmpeg command line tool: ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i my_movie.m3u8 -c copy my_movie.ts Note that if the .m3u8 file was ...
M. Justin's user avatar
  • 293
10 votes

How can I watch an encrypted Blu-ray on a Linux desktop?

I've been working with MakeMKV beta, which is a commercial (beta: shareware) converter that can play DVDs and Blu-ray discs or save them to the hard disk. It is also possible to convert existing .iso ...
kanehekili's user avatar
10 votes

I want to write a script that simultaneously renders what's on my webcam to a window on my screen and records a video

You're 90% there. Instead of trying to read the same camera device (virtual or not), simply add another output to your first ffmpeg invocation. Ffmeg's options are generally in the format: ffmpeg {...
Marcus Müller's user avatar
9 votes

Fast tool to generate thumbnail video galleries for command line

This tool helped me (2019-02) - and it is maintained. Many options - grid, quality, fonts, colors, border, interval, ... https://github.com/amietn/vcsi Create video contact sheets. A video contact ...
hrvoj3e's user avatar
  • 191
9 votes

Multiple /dev/video for one physical device

Really annoying, but just found a solution: let udev assign symlinks for device nodes just for the "real" cams, not the metadata. They are identical (?) to udev, i.e. udevadm info -n /dev/video0 is ...
hubert's user avatar
  • 91
9 votes
Accepted

Why can multiple consumers access a *single* v4l2-loopback stream from a webcam

It's by design. First, let it be said that multiple processes can open the /dev/video0 device, but only one of them will be able to issue certain controls (ioctl()) until streaming starts. Those V4L2 ...
Eduardo Trápani's user avatar
9 votes
Accepted

How to extract every 10th frame from a video?

If you want 1/10 of what you have now (when you use -r 1) then use -r 0.1 It will get 1 frame every 10 seconds instead of 1 frame every 1 second. ffmpeg -i out1.avi -r 0.1 -f image2 image-%3d.jpeg ...
furas's user avatar
  • 256
8 votes

How to extract images from video file?

In VLC you can right click, Video, Take Snapshot
user375835's user avatar
8 votes

Merge two video clips into one, placing them next to each other

ffmpeg -y -ss 0 -t 5 -i inputVideo1.mp4 -ss 0 -t 5 -i inputVideo2.mp4 -i BgPaddingImage.jpg -filter_complex "nullsrc=size=720*720[base];[base][2:v]overlay=1,format=yuv420p[base1];[0:v]...
Sanjay Hadiya's user avatar
8 votes

Is there any video player which can seek with thumbnail like in YouTube?

Ipor Sircer's answer is sufficient and perfect but let me write a step by step answer for beginners. Install mpv. In Ubuntu, you can execute this command. sudo apt update && sudo apt install ...
ynn's user avatar
  • 998
7 votes

Can I pipe /dev/video over ssh

The accepted answer does not work for me. dd simply won't read it. nc is bad if you cant spare another port (I didn't get that to work at all either anyway). cat didn't work for me either. What ended ...
confetti's user avatar
  • 2,164

Only top scored, non community-wiki answers of a minimum length are eligible