Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#5883 closed defect (invalid)

libx264 fails to produce valid output with mp4 container

Reported by: ulatekh Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: libx264
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I managed to find a video that causes ffmpeg to crash and produce invalid output, but only when producing an mp4 container -- the same transcode done with an mkv container works fine.

I first reproduced it with version 2.8.8.1 (i.e from Fedora Core 23 repos), but it also happens with the latest version of ffmpeg (i.e. the 2-Oct-2016 build from https://johnvansickle.com/ffmpeg/).

In the 2.8.8.1 version, the error message is "Incomplete MB-tree stats file". In the latest version, the error message is "2nd pass has more frames than 1st pass".

Enclosed is the script that I used to transcode the video, and a short video that demonstrates the problem. The command line to run the script is:

./mv-met.sh "216 - Dancing above turbines.mpg" 1000 2000 "216 - Dancing above turbines.mp4"

Substitute mkv for mp4 in the target filename and it'll work.

Attachments (1)

mv-met.sh (799 bytes) - added by ulatekh 2 years ago.
Transcoding script

Download all attachments as: .zip

Change History (7)

Changed 2 years ago by ulatekh

Transcoding script

comment:1 Changed 2 years ago by ulatekh

Since the upload limit for attachments is 2.5 MB, and the video that reproduces the problem is 19 MB, I've put it on box.com . See https://app.box.com/s/2xc7s0qck2t166gzveybmchcincglrvn .

comment:2 Changed 2 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed

You are lucky: If FFmpeg / x264 would not crash, you wouldn't know that the quality of your encode is completely broken.
You have to use the same output container format and the same audio options for both passes when doing two-pass encoding (if mov is involved).
For future tickets, please remember that we do not accept scripts, actual command lines together with their complete, uncut console output are required for valid tickets.

comment:3 Changed 2 years ago by cehoyos

  • Keywords libx264 added

comment:4 Changed 2 years ago by ulatekh

I never expected that the container format would affect the behavior of encoding the streams inside the container.

Perhaps the 2nd pass should have detected that and emitted a more descriptive error message, to avoid silently producing a "completely broken" encode.

comment:5 Changed 2 years ago by oromit

I think both errors you got are very clear about the stats file being invalid for your second pass.

comment:6 Changed 2 years ago by ulatekh

But not why.

Note: See TracTickets for help on using tickets.