[FFmpeg-trac] #786(avformat:new): GXF file frame rate double what it should be for some files.
FFmpeg
trac at avcodec.org
Sun Dec 18 05:36:06 CET 2011
#786: GXF file frame rate double what it should be for some files.
----------------------------------+--------------------------------------
Reporter: ryaowe | Type: defect
Status: new | Priority: normal
Component: avformat | Version: git-master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+--------------------------------------
* Trying to accomplish: Transcode a GXF (mpeg2 video, pcm16le audio) to
any other format
* Problem encountered: Transcoded video plays back at twice the rate it
should.
* Command line: ffmpeg -i fyi.gxf -t 30 -acodec libfaac fyi.mp4
* ffmpeg -v 9 -loglevel 99 -i fyi.gxf:
{{{
ffmpeg version N-35872-g6d8e6fe, Copyright (c) 2000-2011 the FFmpeg
developers
built on Dec 16 2011 16:49:56 with gcc 4.2.1 (Apple Inc. build 5666)
(dot 3)
configuration: --enable-shared --disable-static --disable-doc --enable-
memalign-hack --enable-nonfree --enable-gpl --enable-libfaac --cc=gcc-4.2
--prefix=/Users/ryanowen/src/protoven/uplynk/dependencies/encoder_Darwin_64
--enable-pic --extra-ldflags=-headerpad_max_install_names --enable-debug=3
libavutil 51. 32. 0 / 51. 32. 0
libavcodec 53. 46. 0 / 53. 46. 0
libavformat 53. 26. 0 / 53. 26. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 53. 0 / 2. 53. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[gxf @ 0x7fa48303d820] Format gxf probed with size=2048 and score=100
[mpeg2video @ 0x7fa48304e620] err{or,}_recognition separate: 1; 1
[mpeg2video @ 0x7fa48304e620] err{or,}_recognition combined: 1; 10001
[pcm_s16le @ 0x7fa48303fc20] err{or,}_recognition separate: 1; 1
[pcm_s16le @ 0x7fa48303fc20] err{or,}_recognition combined: 1; 10001
[pcm_s16le @ 0x7fa483040220] err{or,}_recognition separate: 1; 1
[pcm_s16le @ 0x7fa483040220] err{or,}_recognition combined: 1; 10001
[mpeg2video @ 0x7fa48304e620] Unsupported bit depth: 0
[gxf @ 0x7fa48303d820] All info found
Seems stream 0 codec frame rate differs from container frame rate: 119.88
(120000/1001) -> 59.94 (120000/2002)
Input #0, gxf, from 'fyi.gxf':
Metadata:
gxf_timecode : 01:00:48;38
gxf_timecode_at_mark_in: 01:00:48;38
gxf_timecode_at_mark_out: 01:11:38;50
Duration: 00:05:25.09, start: 0.000000, bitrate: 85613 kb/s
Stream #0:0, 41, 1001/120000: Video: mpeg2video (4:2:2), yuv422p,
1280x720 [SAR 1:1 DAR 16:9], 1001/120000, 50000 kb/s, 119.88 fps, 59.94
tbr, 119.88 tbn, 119.88 tbc
Stream #0:1, 2, 1001/120000: Audio: pcm_s16le, 48000 Hz, 1 channels,
s16, 768 kb/s
Stream #0:2, 2, 1001/120000: Audio: pcm_s16le, 48000 Hz, 1 channels,
s16, 768 kb/s
Stream #0:3, 0, 1001/120000: Data: none
At least one output file must be specified
}}}
Some GXF files end up with a frame rate for the video track that is twice
what it should be. In my case, the time base should be 1001 / 60000, but
was 1001 / 120000.
The problem seems to coincide with files that have a fields_per_frame
value of 1 instead of 2. The following patch solved the problem for me,
and allows me to dencode all of my GXF files correctly (both those that
did and did not work correctly prior to the fix).
{{{
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 95a8142..1d9f059 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -351,7 +351,7 @@ static int gxf_header(AVFormatContext *s,
AVFormatParameters *ap) {
st = s->streams[idx];
if (!main_timebase.num || !main_timebase.den) {
main_timebase.num = si->frames_per_second.den;
- main_timebase.den = si->frames_per_second.num * 2;
+ main_timebase.den = si->frames_per_second.num *
(si->fields_per_frame ? si->fields_per_frame : 2);
}
st->start_time = si->first_field;
if (si->first_field != AV_NOPTS_VALUE && si->last_field !=
AV_NOPTS_VALUE)
}}}
I'll upload a test file to upload.ffmpeg.org, called double_framerate.gxf
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/786>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list