21

I'm transcoding some of my old mpeg4 videos (in avi containers) to h.264 with FFmpeg. Basically

ffmpeg -i input.avi -c:v libx264 [x264 settings] -c:a libfdk_aac [aac settings] output.mp4

When doing so, mpeg4 issues the following warning

Video uses a non-standard and wasteful way to store B-frames ('packed B-frames'). Consider using a tool like VirtualDub or avidemux to fix it.

I know I can still successfully transcode, but from the warning it is not clear to me whether the quality of the resulting h.264 video will be affected.

So,

  • Given that I only care about the quality (and size, I want to minimize the size for my mobile devices, which is why I'm also using the veryslow preset) of the output h.264 video, should I care about the packed B-frames?

  • If I should, how do I fix them with avidemux? (I already tried skimming through the manual.)

1 Answer 1

28

B-frames are a frame type used in video compression to represent frames of a video. B-frames can use information from both previous and future frames to represent each video frame.

Older DivX-encoded videos commonly use an ugly method called packed bitstream which puts several video frames into a single AVI chunk. Packed bitstream isn't standard MPEG-4, uses more space, requires more CPU power to encode/decode, and (most importantly) may cause problems if copied into another container type. This is the main reason for the warning.

Since you're re-encoding the video instead of just copying it, you should be fine. If you wanted to keep the original video, but copy it into another type of container (say MP4 or MKV), it'd be best to unpack the B-frames first using the FFmpeg filter mpeg4_unpack_bframes.

You could unpack the B-frames with something simple like

ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
1
  • You mean if I'm re-encoding the video, there's no need to use the filter? In another words, re-encoding fixes the issue automatically and makes a proper video output?
    – hamidi
    Commented Jun 7, 2023 at 18:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .