Skip to main content
22 votes
Accepted

How is this .mp4 file 596523 hours long?

There are several things we can note here: The file stops playing after 0:05:30. If you remux the file (mkvtools for example) you do have 5:30 displayed as the length. The original file does in fact ...
v010dya's user avatar
  • 860
14 votes
Accepted

How to encode for YouTube with ffmpeg?

Use ffmpeg -i in.mp4 -vf yadif,format=yuv420p -force_key_frames "expr:gte(t,n_forced/2)" -c:v libx264 -crf 18 -bf 2 -c:a aac -q:a 1 -ac 2 -ar 48000 -use_editlist 0 -movflags +faststart out....
Gyan's user avatar
  • 33.3k
13 votes

Removing MP4 encoding information

Use bitstream filter filter_units with ffmpeg 4.0 or newer. ffmpeg -i INPUT -c copy -bsf:v 'filter_units=remove_types=6' OUTPUT P.S. /* NAL unit types */ enum { H264_NAL_SLICE = 1, ...
whmiao's user avatar
  • 131
13 votes
Accepted

ffmpeg- What's the difference between "NN000/1000 fps" and "NN000/1001 fps"?

Yes, 24000/1000 is 24 fps and 24000/1001 is 23.976fps. Some refer to the X/1001 frame rates as "drop down" (as in "dropped down from the integer") but this is easy to confuse with "pull down" which ...
MmmHmm's user avatar
  • 397
12 votes

Why processor is "better" for encoding than GPU?

2017 update: ffmpeg supports h264 and h265 NVENC GPU-accelerated video encoding. You can do 1-pass or 2-pass encoding at the quality that you choose, for either hevc_nvenc or h264_nvenc, or and even ...
Jack's user avatar
  • 121
9 votes

8bit vs 10bit vs 12bit

I can answer your first question. At the same bitrate and transcoding from an 8-bit source 10-bit HEVC is better than 8-bit HEVC, because it hardcodes dither. archived version of https://gist.github....
Lakis01's user avatar
  • 99
8 votes
Accepted

Digitize a VHS tape with FFmpeg and get a live preview

The tee muxer is suitable for this. ffmpeg \ -f v4l2 -standard PAL -thread_queue_size 2048 -i /dev/video1 \ -f alsa -thread_queue_size 2048 -i hw:2,0 \ -map 0 -map 1 \ -vf yadif=1 \ -vcodec libx264 -...
Gyan's user avatar
  • 33.3k
7 votes
Accepted

Mono to Stereo using FFMPEG

If you run ffmpeg -layouts, you will see that stereo indicates the presence of two channels, one assigned as Front Left and the other as Front Right. If you use -ac 2 in your encode, ffmpeg will ...
Gyan's user avatar
  • 33.3k
6 votes

How to force Adobe Media Encoder to use 100% CPU and memory?

I'm not happy when I'm rendering unless I can actually smell burning plastic, nothing is more frustrating than AE telling you that your render won't complete until the heat death of the universe, ...
stib's user avatar
  • 13.7k
6 votes
Accepted

Removing MP4 encoding information

Regular ffmpeg won't do this. You'll need a combination of two tools to carry this out. #1 Use ffmpeg from direct264, a modded version of an old ffmpeg build with a custom filter to modify H264 ...
Gyan's user avatar
  • 33.3k
6 votes

8bit vs 10bit vs 12bit

I've been running some tests lately (2H2020) concerning reducing the size of some high quality movies of my collection, just for PC to TV 1080p viewing, from 20-30mbps videos to 2-3mbps ones. To that ...
Th Econ's user avatar
  • 61
6 votes

8bit vs 10bit vs 12bit

In my experience (using handbrake) increasing the bit depth increases the file size but not by much. However, lowering the CRF is what causes significantly larger files. I encoded several times the ...
NicolasPP's user avatar
6 votes

ffmpeg- What's the difference between "NN000/1000 fps" and "NN000/1001 fps"?

Those are rational numbers. So, 24000/1000 = 24.000 and 24000/1001 = 23.976. These are in fact the exact representations i.e. 23.976 is an approximation but 24000 divided by 1001 isn't. As for why ...
Gyan's user avatar
  • 33.3k
6 votes
Accepted

4:3 video has 720x480 resolution

There are 2 different things: The real width and height of frames (in pixels) – see the green part of the following picture. The displayed width and height (during the playback) – see the blue part ...
MarianD's user avatar
  • 1,574
6 votes
Accepted

Resuming a partially-completed encode with FFmpeg

I've come up with a "good enough" solution to this problem, as it doesn't appear possible at the time of writing to actually pick up a partial encode that was cut off arbitrarily and ...
Zach F.'s user avatar
  • 341
5 votes

What is the colour range of most videos?

Most videos are limited range i.e. luma goes from 16 to 235, and chroma from 16 to 240. Unless expressly set, FFmpeg does not scale the range from one to another. Whatever the source is, that's the ...
Gyan's user avatar
  • 33.3k
5 votes

4:3 video has 720x480 resolution

525/60 digitized SD video according to Rec. 601 is indeed 720 pixels wide, 480 pixels high, including some blanking on the sides. Digital equivalent of 625/50 is 720x576. In both cases, frame aspect ...
Rusty Core's user avatar
5 votes
Accepted

Call FFmpeg filter from source code (C API)

You can't just call a filter, You must instantiate a filter graph. First you need to create a buffer and buffersink via: AVFilterContext* source = 0; AVFilterContext* sink = 0; AVFilterGraph *graph =...
SlimSCSI's user avatar
  • 1,090
5 votes

How to extract each video scene with FFmpeg

Using the encoder's scenecut to detect scenes is not advisable, since its purpose is efficient GOP splitting taking into account other encoding parameters. It is not a "pure" scene detector. Its ...
Gyan's user avatar
  • 33.3k
5 votes
Accepted

How to tell ffmpeg to copy all streams except one audio stream (to encode)?

Use ffmpeg -i input.mkv -map_metadata 0 -map 0 -c copy -c:a:0 ac3 -vbr 3 output.mkv See https://superuser.com/a/1219824 for an illustrated guide to how stream options are parsed.
Gyan's user avatar
  • 33.3k
5 votes
Accepted

How to convert 10-bit H.265 videos to H.264 without losing quality

It looks like the Video is encoded in 4000 kbit/s, instead of a Rate Factor (RF). But that isn't the issue here. The issue is: while 264 does support lossless encoding, it not widely compatible! (you ...
Pingger Shikkoken's user avatar
4 votes
Accepted

Does repeatedly saving a video degrade its quality?

MP4 isn't an ideal format for intermediate saves. If you know you'll be re-opening the file, save it as losslessly as practicable, and use MP4 only for the final output. That said, depending on the ...
Jim Mack's user avatar
  • 4,674
4 votes

Maximizing FPS of ffmpeg encoding

There is a special NVIDIA API that allows you to encode to h264/h265 called NVENC. It's now integrated into ffmpeg so using it is quite easy. But before buying an NVIDIA card you should do/know the ...
Sergey's user avatar
  • 126
4 votes
Accepted

What's different between Premiere's own h.264 and QT h.264 encoders?

The encoder is always the same, namely Adobe Media Encoder. What you're changing is only the format, which admittedly is a bit confusing since that dropdown mixes up a couple of concepts which don't ...
MoritzLost's user avatar
  • 5,412
4 votes
Accepted

What deinterlacing filter should I use to encode/compress a PAL MPEG-2 576i 25fps raw file?

I don't agree that the other answer is a good idea in general, because "-vf yadif" will drop half the frames, thus resulting in a poor substitute of the original footage. Here is the thing: 576i25 ...
Mephisto's user avatar
  • 275
4 votes

ffmpeg- What's the difference between "NN000/1000 fps" and "NN000/1001 fps"?

The original framerate for broadcast television was 60 fields (half of a frame) per second in the U.S., and timing was based on the oscillation of AC power (so, clearly, European television needed a ...
DepressedDaniel's user avatar
4 votes
Accepted

Is it safe to use the yuva420 pix_format option with ffmpeg to encode webm videos?

YUV color encoding with 4:2:0 chroma subsampling is the only widely safe pixel format for web playback, although for certain codecs, other pixel formats may be supported. FFmpeg auto-selects the ...
Gyan's user avatar
  • 33.3k
4 votes

How to optimize already-encoded videos of still images (e.g. presentation slides)?

(Ideally unaffected parts of the stream would be copied directly without being re-encoded, but if this isn't possible then I can live with a bit of quality loss.) First of all, I doubt there's a way ...
veikk0's user avatar
  • 164
4 votes
Accepted

Errors in converting mp4 to ts with FFmpeg

a) -bsf h264_mp4toannexb applies the filter to all output streams but it has to be applied to only video streams. b) In any case, newer versions of ffmpeg, like the one you have, will automatically ...
Gyan's user avatar
  • 33.3k
4 votes
Accepted

Is CABAC encoding lossy or lossless in ffmpeg?

Cabac is lossless, but h264 is lossy. The part you are missing is that cabac is not THE compression algorithm. It is just the final step out of hundreds of steps in video compression. By the time you ...
SlimSCSI's user avatar
  • 1,090

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