64 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
  • 33.1k
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
  • 33.1k
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
  • 33.1k
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
  • 33.1k
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,670
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,504
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
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
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
  • 33.1k
5 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
  • 33.1k
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

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
  • 341
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
  • 33.1k
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
  • 33.1k
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

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
  • 33.1k
3 votes

Audio issue on concatenation of TS segments

Don't use the concat demuxer. Create a single ts file by concatenating the ts segments as a first step. Then run it through ffmpeg. i.e. cat 1.ts 2.ts >all.ts ffmpeg -i all.ts -c copy all.mp4
SlimSCSI's user avatar
  • 1,070
3 votes

How does the h.264 encoder determine where to put i-frames?

This is a complex topic, with the exact algorithm unique to each encoder. Below is a pseudocode explanation from a x264 developer. B-frames aren't accounted for, but basic logic should be similar. ...
Gyan's user avatar
  • 33.1k
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
3 votes

Record desktop at 1080p60 in high quality

Try lossless encoding with ffmpeg First, with YUV444P ffmpeg -f gdigrab -framerate 60 -i desktop -crf 0 -pix_fmt yuv444p -preset ultrafast yuv-cap.mp4 If not clear enough, ffmpeg -f gdigrab -...
Gyan's user avatar
  • 33.1k
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

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

I've tested lot of solutions and software. I love cli commands, so using ffmpeg you can fix your video file with no hassle. Try the next command if you came here searching some useful fix: ffmpeg -...
user4056's user avatar
3 votes
Accepted

Is there a mathematical equation to compute the bitrate of a Cisco H.264 stream?

No, because it's content dependent. Video with high motion contains more information than a nearly still scene does. Hence it takes more bits to encode.
SlimSCSI's user avatar
  • 1,070
3 votes
Accepted

Is H264 an actual file format?

I'd bet cash money they don't know what they're talking about when they say h264 format. There is a raw h.264 bitstream format, with the file suffix .264, but it's pretty obscure (I can't duckduckgo ...
stib's user avatar
  • 13.7k
3 votes
Accepted

how to use h264_omx on RaspberryPi

The first priority here is to determine the bottleneck, particularly on the encoding end first, then moving on elsewhere. This is noted by the comment on the choppy video stream, indicating frame-...
Dennis Mungai's user avatar
3 votes

Reencoding H.264 to H.264 made it 40% larger

You are using a quality based variable bitrate compression factor on something that already has artifacts. That means it is going to attempt to preserve the video exactly as it is, artifacts included ...
AJ Henderson's user avatar
  • 19.4k
3 votes
Accepted

How to set ffmpeg encoding framerate?

That's processing speed i.e. ffmpeg is encoding 18 frames per second, not the output file's framerate. You can set -preset fast to speed it up but again this has nothing to do with output file's ...
Gyan's user avatar
  • 33.1k
3 votes
Accepted

Are JPEG compression and H.264 intraframe compression the same process?

This is a complex topic, so best to link and excerpt From https://sonnati.wordpress.com/2010/10/19/h-264-for-image-compression/ H.264 contains a number of new features that allow it to compress ...
Gyan's user avatar
  • 33.1k

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