[FFmpeg-user] ffmpeg synchronization

Spencer Graves spencer.graves at prodsyse.com
Fri Mar 14 05:35:10 CET 2014


Hello:


       How can I force the video and audio to start together?


       I have a 1 minute mp2 audio file that I want to match with 15 png 
files, giving 4 seconds to each image.  Below please find what I tried.  
The resulting video skips the first png file entirely and displays the 
second png image for 16 seconds before starting the third image.


       Suggestions?
       Thanks,
       Spencer


 >ffmpeg -y -r 1 -i restrictSecrecy2014-03-07c.mp2   -r 0.25 -i 
restrictSecrecy%d.png   -b:v 300k -pix_fmt yuv420p restrictSecrecy.mp4
ffmpeg version N-61163-gd1122b7 Copyright (c) 2000-2014 the FFmpeg 
developers
   built on Mar  7 2014 22:01:29 with gcc 4.8.2 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-w32threads 
--enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r 
--enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca 
--enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug 
--enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg 
--enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr 
--enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab 
--enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx 
--enable-libwavp
ack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid 
--enable
-zlib
   libavutil      52. 66.101 / 52. 66.101
   libavcodec     55. 52.102 / 55. 52.102
   libavformat    55. 33.101 / 55. 33.101
   libavdevice    55. 11.100 / 55. 11.100
   libavfilter     4.  3.100 /  4.  3.100
   libswscale      2.  5.101 /  2.  5.101
   libswresample   0. 18.100 /  0. 18.100
   libpostproc    52.  3.100 / 52.  3.100
[mp3 @ 04655400] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'restrictSecrecy2014-03-07c.mp2':
   Metadata:
     album           : Restrict secrecy more than data colleciton
     title           : audio
     track           : 1
     artist          : Spencer Graves
     genre           : audio
     date            : 2014
   Duration: 00:01:00.29, start: 0.000000, bitrate: 159 kb/s
     Stream #0:0: Audio: mp2, 44100 Hz, stereo, s16p, 159 kb/s
Input #1, image2, from 'restrictSecrecy%d.png':
   Duration: 00:00:00.60, start: 0.000000, bitrate: N/A
     Stream #1:0: Video: png, rgba, 1058x794 [SAR 3780:3780 DAR 
529:397], 25 fps,
  25 tbr, 25 tbn, 25 tbc
[libx264 @ 047147c0] using SAR=1/1
[libx264 @ 047147c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 047147c0] profile High, level 3.1
[libx264 @ 047147c0] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC 
codec - Cop
yleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 
ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 
mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 
fast_pskip=1 chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 
decimate=1 i
nterlaced=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=1 
scenecu
t=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=300 
ratetol=1.0 qco
mp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'restrictSecrecy.mp4':
   Metadata:
     album           : Restrict secrecy more than data colleciton
     title           : audio
     track           : 1
     artist          : Spencer Graves
     genre           : audio
     date            : 2014
     encoder         : Lavf55.33.101
     Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), 
yuv420p, 1058x7
94 [SAR 1:1 DAR 529:397], q=-1--1, 300 kb/s, 16384 tbn, 0.25 tbc
     Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 
44100 Hz, s
tereo, s16, 128 kb/s
Stream mapping:
   Stream #1:0 -> #0:0 (png -> libx264)
   Stream #0:0 -> #0:1 (mp2 -> libvo_aacenc)
Press [q] to stop, [?] for help
frame=   15 fps=0.0 q=0.0 size=       0kB time=00:00:05.07 bitrate=   
0.1kbits/s
frame=   15 fps= 15 q=0.0 size=     256kB time=00:00:26.34 bitrate= 
79.6kbits/s
frame=   15 fps= 10 q=0.0 size=     589kB time=00:00:47.63 bitrate= 
101.3kbits/s
frame=   15 fps=5.6 q=-1.0 Lsize=    3218kB time=00:01:00.01 bitrate= 
439.3kbits
/s
video:2268kB audio:938kB subtitle:0 data:0 global headers:0kB muxing 
overhead 0.
365568%
[libx264 @ 047147c0] frame I:3     Avg QP: 1.25  size:173903
[libx264 @ 047147c0] frame P:11    Avg QP: 3.89  size:162066
[libx264 @ 047147c0] frame B:1     Avg QP: 3.48  size: 17350
[libx264 @ 047147c0] consecutive B-frames: 86.7% 13.3%  0.0%  0.0%
[libx264 @ 047147c0] mb I  I16..4: 67.4%  1.2% 31.4%
[libx264 @ 047147c0] mb P  I16..4: 12.4%  6.3% 26.6%  P16..4:  3.7% 
1.0%  1.0%
  0.0%  0.0%    skip:49.2%
[libx264 @ 047147c0] mb B  I16..4:  0.1%  0.1%  1.5%  B16..8:  3.7% 
0.4%  0.8%
  direct: 0.9%  skip:92.6%  L0:60.8% L1:35.8% BI: 3.4%
[libx264 @ 047147c0] final ratefactor: 8.13
[libx264 @ 047147c0] 8x8 transform intra:9.1% inter:9.4%
[libx264 @ 047147c0] coded y,uvDC,uvAC intra: 47.6% 48.8% 48.8% inter: 
3.4% 5.9%
  5.9%
[libx264 @ 047147c0] i16 v,h,dc,p: 87%  6%  4%  2%
[libx264 @ 047147c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 21% 22%  3% 4%  
4%  4%
  4%  6%
[libx264 @ 047147c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 21% 14%  5% 6%  
6%  6%
  5%  6%
[libx264 @ 047147c0] i8c dc,h,v,p: 70% 11% 15%  5%
[libx264 @ 047147c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 047147c0] ref P L0: 46.9%  5.2% 41.1%  6.8%
[libx264 @ 047147c0] kb/s:309.57



More information about the ffmpeg-user mailing list