[FFmpeg-user] ffmpeg generates videos with start time greater than 0

Alfredo Aiello stuzzo at gmail.com
Wed Mar 11 19:49:30 CET 2015


I'm trying to cut videos with ffmpeg. I know how to do it in the "normal 
way":

     ffmpeg -i test.mp4 -ss 0 -t 6 -c:v libx264 -profile:v main -level 
3.1 -preset medium -crf 20 -r 25 -b:v 1200k -minrate 1200k -maxrate 
1200k -bufsize 1835k -c:a libfdk_aac -ar 48000 -ac 2 -ab 128k trimmed.mp4

Here's my problem. When I cut, but I noticed in others commands too, 
when I check my file with

     ffmpeg -i trimmed.mp4

output shows me this strange line:

     Duration: 00:00:06.04, start: 0.042667

Why my video duration is 00:00:06.04? And why it starts on 0.042667?
In my application, I need that every video is exactly 6 seconds because 
after I concat 6 videos, I put on them an overlay that shows a different 
text every 6 seconds.
Actually the result video is not correct because the overlay isn't 
synced with videos.

I tried my case with 6 videos that has Duration 00:00:06.00 and start 
0.0000 and the result was ok.
Is there a way to set exactly the Duration and the start?
I found a similar problem here <https://trac.ffmpeg.org/ticket/3353>.

Command output:

     ffmpeg -i sample.mov -ss 1 -t 6 -c:v libx264 -profile:v main -level 
3.1 -preset medium -crf 20 -r 25 -b:v 1200k -minrate 1200k -maxrate 
1200k -bufsize 1835k -c:a libfdk_aac -ar 48000 -ac 2 -ab 128k  -y 
testTrim.mp4
     ffmpeg version 2.3.git Copyright (c) 2000-2014 the FFmpeg developers
       built on Aug  7 2014 18:14:20 with gcc 4.6 (Ubuntu/Linaro 
4.6.3-1ubuntu5)
       configuration: --prefix=/home/stuzzo/ffmpeg_build 
--extra-cflags=-I/home/stuzzo/ffmpeg_build/include 
--extra-ldflags=-L/home/stuzzo/ffmpeg_build/lib 
--bindir=/home/stuzzo/bin --extra-libs=-ldl --enable-gpl --enable-libass 
--enable-libfdk-aac --enable-libmp3lame --enable-libopus 
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid 
--enable-libx264 --enable-nonfree
       libavutil      52. 98.100 / 52. 98.100
       libavcodec     55. 72.102 / 55. 72.102
       libavformat    55. 51.101 / 55. 51.101
       libavdevice    55. 13.102 / 55. 13.102
       libavfilter     4. 11.102 /  4. 11.102
       libswscale      2.  6.100 /  2.  6.100
       libswresample   0. 19.100 /  0. 19.100
       libpostproc    52.  3.100 / 52.  3.100
     Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mov':
       Metadata:
         major_brand     : qt
         minor_version   : 537199360
         compatible_brands: qt
         creation_time   : 2005-10-17 22:54:32
       Duration: 00:01:25.50, start: 0.000000, bitrate: 307 kb/s
         Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 
0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 261 kb/s, 10 fps, 10 
tbr, 3k tbn, 25 tbc (default)
         Metadata:
           creation_time   : 2005-10-17 22:54:33
           handler_name    : Apple Video Media Handler
           encoder         : 3ivx D4 4.5.1
         Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 32000 Hz, 
mono, fltp, 43 kb/s (default)
         Metadata:
           creation_time   : 2005-10-17 22:54:34
           handler_name    : Apple Sound Media Handler
     [libx264 @ 0x2ad0620] using SAR=1/1
     [libx264 @ 0x2ad0620] using cpu capabilities: MMX2 SSE2Fast SSSE3 
SSE4.2 AVX
     [libx264 @ 0x2ad0620] profile Main, level 3.1
     [libx264 @ 0x2ad0620] 264 - core 142 - H.264/MPEG-4 AVC codec - 
Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: 
cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 
lookahead_threads=2 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=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1200 
vbv_bufsize=1835 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
     Output #0, mp4, to 'testTrim.mp4':
       Metadata:
         major_brand     : qt
         minor_version   : 537199360
         compatible_brands: qt
         encoder         : Lavf55.51.101
         Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 
0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 1200 kb/s, 25 fps, 
12800 tbn, 25 tbc (default)
         Metadata:
           creation_time   : 2005-10-17 22:54:33
           handler_name    : Apple Video Media Handler
           encoder         : Lavc55.72.102 libx264
         Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 
0x0040), 48000 Hz, stereo, s16, 128 kb/s (default)
         Metadata:
           creation_time   : 2005-10-17 22:54:34
           handler_name    : Apple Sound Media Handler
           encoder         : Lavc55.72.102 libfdk_aac
     Stream mapping:
       Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
       Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
     Press [q] to stop, [?] for help
     frame=  149 fps=0.0 q=-1.0 Lsize=     122kB time=00:00:06.01 
bitrate= 165.5kbits/s dup=89 drop=0
     video:21kB audio:95kB subtitle:0kB other streams:0kB global 
headers:0kB muxing overhead: 4.938407%
     [libx264 @ 0x2ad0620] frame I:1     Avg QP: 8.65  size:   425
     [libx264 @ 0x2ad0620] frame P:42    Avg QP: 9.92  size:   347
     [libx264 @ 0x2ad0620] frame B:106   Avg QP: 9.92  size:    56
     [libx264 @ 0x2ad0620] consecutive B-frames:  4.7%  1.3%  0.0% 94.0%
     [libx264 @ 0x2ad0620] mb I  I16..4: 98.8%  0.0%  1.2%
     [libx264 @ 0x2ad0620] mb P  I16..4:  1.3%  0.0%  0.5%  P16..4: 
1.2%  0.4%  0.3%  0.0%  0.0%    skip:96.3%
     [libx264 @ 0x2ad0620] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 
2.1%  0.0%  0.0%  direct: 0.0%  skip:97.8%  L0:26.8% L1:73.2% BI: 0.1%
     [libx264 @ 0x2ad0620] coded y,uvDC,uvAC intra: 11.0% 2.5% 0.6% 
inter: 0.1% 0.1% 0.0%
     [libx264 @ 0x2ad0620] i16 v,h,dc,p: 60% 39%  0%  0%
     [libx264 @ 0x2ad0620] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 42% 17%  
2%  2%  3%  3%  3%  2%
     [libx264 @ 0x2ad0620] i8c dc,h,v,p: 83% 15%  2%  0%
     [libx264 @ 0x2ad0620] Weighted P-Frames: Y:0.0% UV:0.0%
     [libx264 @ 0x2ad0620] ref P L0: 82.2%  5.1% 10.5%  2.2%
     [libx264 @ 0x2ad0620] ref B L0: 56.4% 43.6%
     [libx264 @ 0x2ad0620] ref B L1: 99.4%  0.6%
     [libx264 @ 0x2ad0620] kb/s:28.08

Thank you


More information about the ffmpeg-user mailing list