Hot answers tagged

134 votes
Accepted

Repeat/loop Input Video with ffmpeg?

-stream_loop option ffmpeg -stream_loop 3 -i input.mp4 -c copy output.mp4 This can avoid re-encoding because it can use stream copy. 0 means no loop, -1 means infinite loop. This may not work with ...
  • 9,349
57 votes
Accepted

Fix bad files and streams with ffmpeg so VLC and other players would not crash

If parts of the file reside on physically bad sectors, or for whatever reason, the OS cannot serve the whole file to FFmpeg, then naturally FFmpeg can't do anything about that. You should get a ...
  • 30.7k
31 votes

Repeat/loop Input Video with ffmpeg?

With ffmpeg 2.8.4, the following command creates output.mp4 that is a repeating copy of input.mp4 until the ffmpeg process is stopped: ffmpeg -stream_loop -1 -i input.mp4 -c copy output.mp4 This ...
  • 456
22 votes
Accepted

MP4 / h.264 patent issues?

IANAL, but as far as I understand it, if you're charging viewers for h.264 / MPEG-4 AVC content you may need to pay license fees. Even though x264 / ffmpeg are Free with a big F, they are just ...
  • 13.5k
16 votes
Accepted

encoding 4:2:2 in 10-bit with libx264

x264 supports both 8-bit and 10-bit outputs, and you don't have to do anything special. ffmpeg If using ffmpeg you can see what pixel formats and bit depths are supported by libx264: $ ffmpeg -h ...
  • 9,349
16 votes

Repeat/loop Input Video with ffmpeg?

At least on FFmpeg 2.8.x (but oldie should works too) you can use lavfi as input format and complex filter graph using movie and setpts filters as a argument for -i option. Next command doing this ...
  • 261
13 votes
Accepted

H.264 or VP9 for encoding for YouTube?

tl;dr: Since Youtube reencodes all videos regardless of the upload format, it really isn't that important. Just export your video with a high bitrate to preserve quality. Also see my answer here ...
  • 5,392
13 votes
Accepted

Using h264 in loseless mode brings small unexpected results

It's an artifact of the player, not the encoder. I used the command below to generate a RGB format capture in HuffYUV ffmpeg -f dshow -video_size 1920x1080 -framerate 30 -i video="screen-capture-...
  • 30.7k
13 votes
Accepted

ffmpeg: explicitly tag h.264 as bt.601, rather than leaving unspecified?

PAL and NTSC have different color primaries, so NTSC = SMPTE 170M = BT 601 525 PAL = BT 470 BG = BT 601 625 See the rows for value 5 & 6 on the table on page 387 of the active H.264 standard. ...
  • 30.7k
10 votes
Accepted

ffmpeg encode in all-i mode h264 and h265 streams

For H264 ffmpeg -i input -c:v libx264 -intra output For H265, seems no alias or preset has been set yet ffmpeg -i input -c:v libx265 -x265-params frame-threads=4:keyint=1:ref=1:no-open-gop=1:...
  • 30.7k
9 votes

How can I convert .MTS file (AVCHD) to .mp4 by ffmpeg without re-encoding H264 video stream?

Seeing that in the text of your question you have started discussing other utilities, i will assume that you are not interested in sticking with ffmpeg, but rather in getting the job done. In my ...
  • 810
8 votes

MP4 / h.264 patent issues?

Edit: I should probably remove some of the worrying conclusions about using x264 / ffmpeg that I now believe are unfounded. I put a section at the end to clear it up. For now I'm going to leave the ...
  • 2,650
8 votes
Accepted

Differences of h.264 and h.265?

HEVC (High Efficiency Video Coding), the new video coding standard brings promise of huge bandwidth savings of approx. 40-45% over H.264 encoded content More info here
  • 216
8 votes
Accepted

FFMPEG: Loop video to the length of audio

For video, stream_loop option should be used. ffmpeg -y -stream_loop -1 -i video -i audio.mp3 -fflags +shortest -max_interleave_delta 50000 -c copy output.mp4 You'll have to use a very recent ...
  • 30.7k
8 votes
Accepted

What's the difference between "visually lossless" and real lossless and what does this mean for future encodes?

Technically lossless, or real lossless, means that when the output is decoded by a conformant decoder, the result is mathematically identical to the input. Visually lossless is a non-rigorous term ...
  • 30.7k
7 votes

H.264 or VP9 for encoding for YouTube?

YouTube will re-encode whatever you give it. VP9 is currently too slow to encode. So the best choice is to either: Give it the original footage, or if it is not accepted by YouTube or is too big to ...
  • 9,349
7 votes

encoding 4:2:2 in 10-bit with libx264

edit: I successfully made a 10bit encode of Ducks Take Off. First way: I built a 10bit x264 binary that statically links libx264. cp -al x264-git x264-10bit # instead of changing my normal git ...
  • 2,650
7 votes
Accepted

H.264 Max Resolution

One of the bits of information associated with a H264 stream is its level. The level informs the decoder the computational resources needed for a successful decode. Turns out that the highest level 5....
  • 30.7k
7 votes
Accepted

What CRF or settings I should choose for h265 in order to achieve a similiar quality of h264?

The CRF scales for x264 and x265 do not correspond. x265 CRF 28 is supposed to be equivalent to x264 CRF 23. But x265 is not yet as mature in its development as x264, so take that CRF equivalence with ...
  • 30.7k
6 votes
Accepted

Can I use h.264 codec inside .mp4 container for my website

You are correct: h.264 is non-free and content producers as well as developers are obliged to pay royalties to MPEGLA for its use - but only if they are charging for their content, and the volume goes ...
  • 13.5k
6 votes

Can I use h.264 codec inside .mp4 container for my website

Use it. Nothing else can provide the the same quality per bitrate as x264 (the top-class H.264 encoder) while not taking 10,000 years to encode (x265 'n VP9). Some tips: Use a recent ffmpeg build ...
  • 9,349
6 votes

Can H264 achieve "equivalence" with ProRes 422?

Has anyone done or seen any tests comparing Apple ProRes 422 with high-bitrate H.264? No, but I can tell you that x264 can get as close to lossless as you want (or even mathematically lossless, with -...
  • 2,650
6 votes
Accepted

Can H264 achieve "equivalence" with ProRes 422?

Well going by the numbers h264 has a lesser bit-depth and color accuracy than ProRes 422. PR422 has 10bit and 4:2:2 chroma sub-sampling, h264 has 8bit and 4:2:0 unless you encode in the Hi422P Intra ...
  • 7,169
6 votes
Accepted

Converting video with different resolutions slightly affects in file size, why?

You are using the same bitrate for each video. The bitrate determines how much data is used per second. The resolution has nothing to do with how much data is used, it only impacts the number of ...
  • 19.2k
6 votes

H.264 Max Resolution

H.264/AVC is not limited for 4K in terms of max resolution as it supports DCI 4K (4092x2160) @ 60 fps at Level 5.2. For example Sony already uses XAVC which is exactly 4K AVC. For a while the max ...
  • 406
6 votes
Accepted

It is better to have more B-frames or more P-frame for video streaming?

"Q: Is it better to have more B-frames or more P-frame for video streaming?". From: https://en.wikipedia.org/wiki/Video_compression_picture_types The three major picture types used in the ...
  • 847
5 votes

How can I convert .MTS file (AVCHD) to .mp4 by ffmpeg without re-encoding H264 video stream?

As per this ffmpeg bug Interlaced H.264 packets are split causing MP4 STTS when remuxing a mpeg-ts containing interlaced H.264 into mp4, both fields of each video frame are split into seperate ...
  • 30.7k
5 votes
Accepted

Encoding videos for MPEG-DASH

I would get as far away from EE as possible. Using the x264 tool, and mp4box, you can convert and segment out the files which are ready to be streamed to any dash compatible players. Especially since ...
  • 111
5 votes

Fix bad files and streams with ffmpeg so VLC and other players would not crash

In the search of a better answer a possible way could be: ffmpeg -i video.mkv -c copy video_fixed.mkv However I'm pretty sure there are some extra options that can make the result even better..
  • 1,444
5 votes

How do I encode videos into h.264 at 8k resolution?

Are you sure the 8k videos on your computer are actually h.264, and not h.265? The max resolution of h.264 level 5.2 is still 4096x2305. To convert beyond that in Premiere, you need to chose HEVC (h....
  • 4,246

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