[FFmpeg-user] Converting MPG to MP4 - Output is 2x in Length and Plays 1/2 Speed
Tom Evans
tevans.uk at googlemail.com
Mon Mar 11 17:16:29 CET 2013
On Mon, Mar 11, 2013 at 3:33 PM, Rob Desilets <rd at icalc.com> wrote:
> Hi All,
>
> I have a MPG that I am converting to a MP4. The outputted MP4 is exactly 2x
> the length (22 seconds versus 11 seconds) and the file plays at half speed.
> Do you know what could cause this type of issue?
>
> Here is the command I am using:
>
> ffmpeg -i rob-test.mpg -vf "[in]scale=480:320" -vol 0 -y -c:v libx264 -crf
> 24 -preset slow -profile:v baseline -level 30 -c:a libfaac -q:a 100 -r 30
> new.mp4
>
> P.S. This command works fine for literally thousands of video files that
> come through our system, but this one MPG is causing the issue.
>
> Original:
>
> http://legacy.skydivingphotography.com/rob-test.mpg
>
> Converted:
>
> http://legacy.skydivingphotography.com/new.mp4
>
> Any help would be greatly appreciated..
>
> -ROb
Hmm, if you omit a source fps, it dupes every frame:
ffmpeg -i rob-test.mpg -c:v libx264 -c:a libfaac -r 30 out.mp4
...
frame= 681 fps= 51 q=-1.0 Lsize= 2657kB time=00:00:22.63 bitrate=
961.8kbits/s dup=340 drop=0
ffmpeg thinks the input frame rate is 29.97. If you specify this as an
input framerate, you get no dups, and almost the correct duration
(29.97 != 30). Heck, even if you supply 30 as the input fps, it works
fine too.
Cheers
Tom
PS:
The OP omitted his command lines and output, but I could reproduce
with his sample:
> $ ffmpeg -i rob-test.mpg -c:v libx264 -c:a libfaac -r 30 out.mp4
ffmpeg version N-50519-g037adf5 Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 6 2013 11:47:03 with gcc 4.6.4 (FreeBSD Ports
Collection) 20121102 (prerelease)
configuration: --cc=/usr/local/bin/gcc46
--extra-libs=-L/usr/local/lib --extra-cflags=-I/usr/local/include
--prefix=/usr/local --mandir=/usr/local/man --enable-libx264
--enable-postproc --enable-libfaac --enable-libmp3lame
--enable-libxvid --enable-nonfree --enable-gpl --enable-version3
--enable-libtheora --enable-libvorbis --enable-ffmpeg --enable-ffplay
--enable-ffprobe --enable-shared
libavutil 52. 17.103 / 52. 17.103
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.103 / 54. 63.103
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mpeg @ 0x8064a6400] max_analyze_duration 5000000 reached at 5005000
microseconds
Input #0, mpeg, from 'rob-test.mpg':
Duration: 00:00:11.34, start: 0.360000, bitrate: 7140 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480
[SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
[libx264 @ 0x80641ff00] using SAR=32/27
[libx264 @ 0x80641ff00] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle Cache64
[libx264 @ 0x80641ff00] profile High, level 3.0
[libx264 @ 0x80641ff00] 264 - core 124 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2012 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
Output #0, mp4, to 'out.mp4':
Metadata:
encoder : Lavf54.63.103
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p,
720x480 [SAR 32:27 DAR 16:9], q=-1--1, 15360 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> libx264)
Press [q] to stop, [?] for help
frame= 681 fps= 51 q=-1.0 Lsize= 2657kB time=00:00:22.63 bitrate=
961.8kbits/s dup=340 drop=0
video:2648kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.331589%
> $ ffmpeg -y -r 30 -i rob-test.mpg -c:v libx264 -c:a libfaac -r 30 out.mp4
ffmpeg version N-50519-g037adf5 Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 6 2013 11:47:03 with gcc 4.6.4 (FreeBSD Ports
Collection) 20121102 (prerelease)
configuration: --cc=/usr/local/bin/gcc46
--extra-libs=-L/usr/local/lib --extra-cflags=-I/usr/local/include
--prefix=/usr/local --mandir=/usr/local/man --enable-libx264
--enable-postproc --enable-libfaac --enable-libmp3lame
--enable-libxvid --enable-nonfree --enable-gpl --enable-version3
--enable-libtheora --enable-libvorbis --enable-ffmpeg --enable-ffplay
--enable-ffprobe --enable-shared
libavutil 52. 17.103 / 52. 17.103
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.103 / 54. 63.103
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mpeg @ 0x8064a7400] max_analyze_duration 5000000 reached at 5005000
microseconds
Input #0, mpeg, from 'rob-test.mpg':
Duration: 00:00:11.34, start: 0.360000, bitrate: 7140 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480
[SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
[libx264 @ 0x80641ff00] using SAR=32/27
[libx264 @ 0x80641ff00] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle Cache64
[libx264 @ 0x80641ff00] profile High, level 3.0
[libx264 @ 0x80641ff00] 264 - core 124 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2012 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
Output #0, mp4, to 'out.mp4':
Metadata:
encoder : Lavf54.63.103
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p,
720x480 [SAR 32:27 DAR 16:9], q=-1--1, 15360 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> libx264)
Press [q] to stop, [?] for help
frame= 341 fps= 42 q=-1.0 Lsize= 1555kB time=00:00:11.30
bitrate=1127.2kbits/s
video:1550kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.309782%
More information about the ffmpeg-user
mailing list