Opened 8 years ago

Last modified 8 years ago

#4955 new defect

Converting H.264 Video in MPEG-TS container doubles tbc

Reported by: nixscripter Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: h264 mpegts
Cc: jsantiago@fastmail.us Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When converting video to H.264 in an MPEG-TS container, something strange happens. FFmpeg claims that the output has the same framerate (and tbc and tbn) as the input, but according to FFprobe, the calculated tbc is doubled. This is regardless of vsync or rate (-r) option.

ffplay seems able to deal with it, but other players don't play it back correctly, and it is those other players that led me to this issue.

Attachments (3)

mts_conv_x2_fr_input.mpg (1.3 MB ) - added by nixscripter 8 years ago.
Input Example
mts_conv_x2_fr_output.mts (785.6 KB ) - added by nixscripter 8 years ago.
Output of Converting Example
mts_conv_x2_fr_log.txt (65.7 KB ) - added by nixscripter 8 years ago.
Log Level 99 Output of Converting Example

Change History (11)

by nixscripter, 8 years ago

Attachment: mts_conv_x2_fr_input.mpg added

Input Example

by nixscripter, 8 years ago

Attachment: mts_conv_x2_fr_output.mts added

Output of Converting Example

by nixscripter, 8 years ago

Attachment: mts_conv_x2_fr_log.txt added

Log Level 99 Output of Converting Example

in reply to:  description comment:1 by nixscripter, 8 years ago

To clarify, other players (such as mplayer) playback the video at twice the speed of the audio, i.e. at the calculated tbc rate.

comment:2 by Carl Eugen Hoyos, 8 years ago

Keywords: h264 added

I wasn't able to find another player that fails for the output file you uploaded: Isn't this a bug in MPlayer?

in reply to:  2 comment:3 by nixscripter, 8 years ago

Replying to cehoyos:

I wasn't able to find another player that fails for the output file you uploaded: Isn't this a bug in MPlayer?

It may very well be. However, I wonder if the bug is being triggered by an encoder output that is still unexpected.

As I previously noted, if you ffprobe the output file, you get:

Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 360x240 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

When it was encoded, ffmpeg thought it was generating a file that would be 29.97:

Output #0, mpegts, to 'mts_conv_x2_fr_output.mts':
  Metadata:
    encoder         : Lavf57.10.100
    Stream #0:0, 0, 1/90000: Video: h264 (libx264), -1 reference frame, yuv420p(center), 360x240 [SAR 32:27 DAR 16:9], 1001/30000, q=-1--1, 29.97 fps, 90k tbn, 29.97 tbc

Since even ffprobe read the file and computed an incorrect AVCodecContext time base based on something in the stream, doesn't that indicate something odd happened during encoding? Or is that calculation by ffprobe considered completely arbitrary and lacking any defined behavior?

If the latter is the case, then you can close this bug.

comment:4 by Jose Santiago, 8 years ago

Cc: jsantiago@fastmail.us added

comment:5 by Carl Eugen Hoyos, 8 years ago

comment:6 by Carl Eugen Hoyos, 8 years ago

Keywords: mpegts added

comment:7 by Carl Eugen Hoyos, 8 years ago

Keywords: mpegps added

comment:8 by Carl Eugen Hoyos, 8 years ago

Keywords: mpegps removed
Note: See TracTickets for help on using tickets.