Hot answers tagged

62 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 ...
Gyan's user avatar
  • 32.6k
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 ...
Thingy's user avatar
  • 456
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 ...
Monah Tuk's user avatar
  • 261
15 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. ...
Gyan's user avatar
  • 32.6k
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-...
Gyan's user avatar
  • 32.6k
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:...
Gyan's user avatar
  • 32.6k
9 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....
Gyan's user avatar
  • 32.6k
8 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 ...
Gyan's user avatar
  • 32.6k
8 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 ...
aergistal's user avatar
  • 436
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
Raju's user avatar
  • 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 ...
Gyan's user avatar
  • 32.6k
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 ...
Gyan's user avatar
  • 32.6k
7 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..
user3450548's user avatar
  • 1,616
7 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....
Jason Conrad's user avatar
  • 4,444
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 ...
Rob's user avatar
  • 847
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 ...
Jarmer's user avatar
  • 111
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 ...
Gyan's user avatar
  • 32.6k
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
5 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
  • 321
5 votes
Accepted

ffmpeg vf scale shifts colors to washed out

The video's color transfer characteristics (trc) and color primaries flags are not being set on the output video, which is causing the video player to use incorrect values for playback, resulting in ...
Zach F.'s user avatar
  • 321
4 votes
Accepted

Adobe Premiere saves m4v instead of mp4

I encountered the same issue when I turned the sound off in the sequence. When I re-enabled audio export, even though I didn't want to or need to, it saved as an mp4 again.
Pamela's user avatar
  • 56
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

.mkv file not playing in HEVC/H.265 supported player

Both files that don't play feature Opus as the audio codec. As per this site, Opus is not one of the supported audio codecs. Transcode the audio: ffmpeg -i in.mkv -c:v copy out.mkv
Gyan's user avatar
  • 32.6k
4 votes

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

FFmpeg can use x264 to output to 8K. Basic template: ffmpeg -i 4KfromPremiere.mp4 -vf scale=7680x4320 -crf 20 out.mp4
Gyan's user avatar
  • 32.6k
4 votes
Accepted

Print to file: Details of every NAL unit in raw H.264 file

You can use the trace_headers bitstream filter in ffmpeg ffmpeg -i in.264 -c copy -bsf:v trace_headers -f null - 2> NALUS.txt The text file will have data like this, [AVBSFContext @ ...
Gyan's user avatar
  • 32.6k
4 votes
Accepted

What's special about Apple-device generated HEVC files that (apparently) x265 can't produce?

Well. Turns out that if you read this guide for HLS streams, it gives a bunch of details on how the actual video formats should be set up. In particular, for HEVC, it says: 1.10. You SHOULD use ...
Juan Pablo's user avatar
4 votes
Accepted

Smallest Possible Video File in H.264 Format

A one frame H264 stream would have to consist of an intra-coded frame, so there is a size floor in effect. This ffmpeg command produces a 1.7 kiB file ffmpeg -f lavfi -i color=blue:s=1280x720 -...
Gyan's user avatar
  • 32.6k
4 votes
Accepted

Producing small H.264 files with Adobe Media Encoder vs ffmpeg/libx264

Adobe licenses its H.264 encoder from Mainconcept, which doesn't do that well at low bitrates. x264 is pretty much the frontier when it comes at low size output for a given quality target, or quality ...
Gyan's user avatar
  • 32.6k
3 votes

Differences of h.264 and h.265?

h.265 is obviously more compressed than h.264 and was built for UHD and 4K. Though 1080 files still look great and are even smaller when encoded with h.265 than h.264. Some computers may have trouble ...
A.J. Hernandez's user avatar
3 votes
Accepted

Copying h.264 video from TS into MP4 changes frame rate and time

As per a comment here, removing the -r flag ought to do this properly. You have another -r flag for the input, also. Remove both of them, and it should properly copy the stream as it is into a new ...
r_alex_hall's user avatar

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