[FFmpeg-user] Trimming a MOV creating out-of-sync, under-length result
Stuart Bruce
stuartrbruce at gmail.com
Sat Dec 23 12:39:05 EET 2017
Hello
I'm trying to use FFmpeg for a relatively simple task of trimming a 24fps
.MOV file to make a shorter .MOV.
The source has been exported from Avid Media Composer. Programatically I
know the in point and out point to trim to, and the arguments I'm passing
to FFmpeg look like they ought to be correct (I think?). However, when I
perform the trim and then line up the source with the trimmed version in
Adobe Premiere, I'm finding that:
- The audio is perfectly in sync to the source video, but the video track
is 2 frames early- so where I would expect to see frame 100, instead, I'm
seeing frame 102
- The trimmed .MOV is 1 frame too short for the -t duration that I gave
I'm trying to set this up for long episodes with lots of shots in, where
the automation will be helpful, but it's for animation purposes so video
frame accuracy is going to be essential.
For copyright reasons I can't share that footage so I've done some tests
using homemade footage instead. If anyone's interested, you can find both a
copy of the source video and the inaccurately-trimmed output video here:
http://www.twentypenguins.co.uk/misc/ffmpeg_tests/
The arguments I'm passing and the FFmpeg output I'm getting are pasted
below. I've edited out the filepaths for privacy but they're all valid and
I'm confident that's not the problem.
Is there anyone who might be able to have a look at this and spot why
FFmpeg appears to be generating a file where the video and audio aren't
currently in sync?
Any assistance would be greatly appreciated.
Stuart
Arguments:
-i "OutputTests_24p_v2.mov" -ss 00:00:04.041 -t 00:00:02.720 -r 24
"AR0000003_H264-FF_v20.mov"
FFmpeg output:
ffmpeg version N-89369-g5a93a85fd0 Copyright (c) 2000-2017 the FFmpeg
developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid
--enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
--enable-libmfx
libavutil 56. 4.100 / 56. 4.100
libavcodec 58. 6.102 / 58. 6.102
libavformat 58. 2.103 / 58. 2.103
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 6.100 / 7. 6.100
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'OutputTests_24p_v2.mov':
Metadata:
creation_time : 2017-12-23T10:12:48.000000Z
timecode : 01:00:00:00
Duration: 00:00:09.50, start: 0.000000, bitrate: 3233 kb/s
Stream #0:0(eng): Audio: pcm_s16be (twos / 0x736F7774), 44100 Hz, mono,
s16, 705 kb/s (default)
Metadata:
creation_time : 2017-12-23T10:12:48.000000Z
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv,
smpte170m/smpte170m/bt709), 640x360, 2303 kb/s, 24 fps, 24 tbr, 24k tbn,
48k tbc (default)
Metadata:
creation_time : 2017-12-23T10:12:48.000000Z
handler_name : Apple Alias Data Handler
encoder : H.264
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2017-12-23T10:12:56.000000Z
handler_name : Apple Alias Data Handler
timecode : 01:00:00:00
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (pcm_s16be (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 000001d16eda0d00] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 000001d16eda0d00] profile High, level 3.0
[libx264 @ 000001d16eda0d00] 264 - core 152 r2851 ba24899 - H.264/MPEG-4
AVC codec - Copyleft 2003-2017 - 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=6
lookahead_threads=1 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=24
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, mov, to 'AR0000003_H264-FF_v20.mov':
Metadata:
timecode : 01:00:00:00
encoder : Lavf58.2.103
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
640x360, q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
Metadata:
creation_time : 2017-12-23T10:12:48.000000Z
handler_name : Apple Alias Data Handler
encoder : Lavc58.6.102 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono,
fltp, 69 kb/s (default)
Metadata:
creation_time : 2017-12-23T10:12:48.000000Z
handler_name : Apple Alias Data Handler
encoder : Lavc58.6.102 aac
frame= 66 fps=0.0 q=-1.0 Lsize= 246kB time=00:00:02.73 bitrate=
735.6kbits/s speed=3.67x
video:219kB audio:23kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 1.684352%
[libx264 @ 000001d16eda0d00] frame I:1 Avg QP:24.89 size: 8737
[libx264 @ 000001d16eda0d00] frame P:19 Avg QP:23.00 size: 4080
[libx264 @ 000001d16eda0d00] frame B:46 Avg QP:23.71 size: 2978
[libx264 @ 000001d16eda0d00] consecutive B-frames: 1.5% 12.1% 13.6% 72.7%
[libx264 @ 000001d16eda0d00] mb I I16..4: 28.5% 48.8% 22.7%
[libx264 @ 000001d16eda0d00] mb P I16..4: 35.2% 40.4% 4.5% P16..4:
9.1% 2.7% 1.6% 0.0% 0.0% skip: 6.6%
[libx264 @ 000001d16eda0d00] mb B I16..4: 15.2% 17.9% 1.4% B16..8:
30.4% 4.9% 1.0% direct: 4.7% skip:24.5% L0:58.2% L1:38.5% BI: 3.3%
[libx264 @ 000001d16eda0d00] 8x8 transform intra:51.1% inter:83.2%
[libx264 @ 000001d16eda0d00] coded y,uvDC,uvAC intra: 27.8% 53.2% 2.7%
inter: 17.0% 34.5% 0.3%
[libx264 @ 000001d16eda0d00] i16 v,h,dc,p: 28% 26% 20% 26%
[libx264 @ 000001d16eda0d00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 22% 33%
4% 4% 2% 4% 3% 2%
[libx264 @ 000001d16eda0d00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 22% 29%
4% 5% 3% 6% 3% 2%
[libx264 @ 000001d16eda0d00] i8c dc,h,v,p: 49% 26% 22% 3%
[libx264 @ 000001d16eda0d00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001d16eda0d00] ref P L0: 59.9% 8.7% 18.2% 13.1%
[libx264 @ 000001d16eda0d00] ref B L0: 87.4% 9.6% 3.0%
[libx264 @ 000001d16eda0d00] ref B L1: 95.4% 4.6%
[libx264 @ 000001d16eda0d00] kb/s:649.38
[aac @ 000001d16edb4cc0] Qavg: 670.924
--
Stuart Bruce - stuart at stuartbruce.co.uk - www.stuartbruce.co.uk
More information about the ffmpeg-user
mailing list