[FFmpeg-user] concat with differing tbn in h264 streams

S Andreason sandreas41 at gmail.com
Fri Sep 16 20:08:45 EEST 2016


Carl Eugen Hoyos wrote:
> The input streams have different frame rates, use the -r option when
> encoding the input files (or use setpts if you prefer not to drop / duplicate
> frames).

Hi Carl,
Right, I used -r on file# 3:

~/camera/solar/editing$ ffmpeg -i 
20160916_0601_Conpus-250A-stressTest_trips-90.5A-14m_rec_0828_c315t5.MOV 
-c:v h264 -s 640x360 -r 29.97 -pix_fmt yuvj420p -c:a pcm_s16le -ar 48000 
-ac 2  
20160916_0601_Conpus-250A-stressTest_trips-90.5A-14m_rec_0828_c315t5-h640x360.mov
Input #0,
   Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
1920x1080, 17599 kb/s, 30 fps, 30 tbr, 30k tbn, 60k tbc (default)
Output #0, mov,
   Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), 
yuvj420p(pc), 640x360, q=-1--1, 29.97 fps, 11988 tbn, 29.97 tbc (default)

Okay I'll try setpts:

~/camera/solar/editing$ ffmpeg -i 
20160916_0601_Conpus-250A-stressTest_trips-90.5A-14m_rec_0828_c315t5.MOV 
-c:v h264 -s 640x360 -r 29.97 -pix_fmt yuvj420p -vf 'setpts=N/(25*TB)' 
-c:a pcm_s16le -ar 48000 -ac 2  
20160916_0601_Conpus-250A-stressTest_trips-90.5A-14m_rec_0828_c315t5-h640x360.mov
ffmpeg version 3.1.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr/local --enable-gpl --enable-postproc 
--enable-swscale --enable-libmp3lame --enable-libvorbis --enable-libx264 
--enable-pthreads --enable-libopenjpeg --enable-nonfree 
--disable-ffserver --disable-network --enable-libfreetype 
--enable-libfontconfig --disable-doc --disable-htmlpages 
--disable-podpages --enable-shared --enable-libvpx 
--extra-cflags=-I/usr/include --extra-ldflags=-L/usr/lib/i386-linux-gnu
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
'20160916_0601_Conpus-250A-stressTest_trips-90.5A-14m_rec_0828_c315t5.MOV':
  Metadata:
    major_brand     : qt 
    minor_version   : 512
    compatible_brands: qt 
    encoder         : Lavf57.41.100
    comment         : HDDVR-Mobius
    comment-eng     : HDDVR-Mobius
  Duration: 00:00:05.00, start: 0.000000, bitrate: 18116 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
1920x1080, 17599 kb/s, 30 fps, 30 tbr, 30k tbn, 60k tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : h264
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 32000 Hz, 
mono, s16, 512 kb/s (default)
    Metadata:
      handler_name    : DataHandler
File 
'20160916_0601_Conpus-250A-stressTest_trips-90.5A-14m_rec_0828_c315t5-h640x360.mov' 
already exists. Overwrite ? [y/N] y
[swscaler @ 0xa02a600] deprecated pixel format used, make sure you did 
set range correctly
[libx264 @ 0x9f9f600] using cpu capabilities: none!
[libx264 @ 0x9f9f600] profile High, level 3.0
[libx264 @ 0x9f9f600] 264 - core 142 r2431 a5831aa - 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=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=1 
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=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
[mov @ 0x9fc0380] Using AVStream.codec to pass codec parameters to 
muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mov, to 
'20160916_0601_Conpus-250A-stressTest_trips-90.5A-14m_rec_0828_c315t5-h640x360.mov':
  Metadata:
    major_brand     : qt 
    minor_version   : 512
    compatible_brands: qt 
    comment-eng     : HDDVR-Mobius
    comment         : HDDVR-Mobius
    encoder         : Lavf57.41.100
    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), 
yuvj420p(pc), 640x360, q=-1--1, 29.97 fps, 11988 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.48.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 
stereo, s16, 1536 kb/s (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.48.101 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
frame=  180 fps=4.6 q=29.0 Lsize=    1075kB time=00:00:05.90 
bitrate=1491.2kbits/s dup=30 drop=0 speed=0.151x   
video:133kB audio:938kB subtitle:0kB other streams:0kB global 
headers:0kB muxing overhead: 0.453677%
[libx264 @ 0x9f9f600] frame I:1     Avg QP:21.69  size: 34281
[libx264 @ 0x9f9f600] frame P:45    Avg QP:21.99  size:  1967
[libx264 @ 0x9f9f600] frame B:134   Avg QP:24.49  size:    93
[libx264 @ 0x9f9f600] consecutive B-frames:  0.6%  0.0%  1.7% 97.8%
[libx264 @ 0x9f9f600] mb I  I16..4:  2.5% 46.1% 51.4%
[libx264 @ 0x9f9f600] mb P  I16..4:  0.2%  0.2%  0.0%  P16..4: 30.8%  
3.9%  5.3%  0.0%  0.0%    skip:59.7%
[libx264 @ 0x9f9f600] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  9.7%  
0.0%  0.0%  direct: 0.0%  skip:90.2%  L0:16.4% L1:83.5% BI: 0.1%
[libx264 @ 0x9f9f600] 8x8 transform intra:47.3% inter:66.3%
[libx264 @ 0x9f9f600] coded y,uvDC,uvAC intra: 64.4% 89.3% 70.0% inter: 
3.6% 5.0% 0.5%
[libx264 @ 0x9f9f600] i16 v,h,dc,p: 84%  2% 10%  4%
[libx264 @ 0x9f9f600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39%  5% 24%  4%  
7%  6%  4%  5%  5%
[libx264 @ 0x9f9f600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 14%  9%  6%  
9%  9%  9%  5%  7%
[libx264 @ 0x9f9f600] i8c dc,h,v,p: 43% 17% 32%  8%
[libx264 @ 0x9f9f600] Weighted P-Frames: Y:2.2% UV:2.2%
[libx264 @ 0x9f9f600] ref P L0: 72.4%  6.2% 17.3%  3.9%  0.3%
[libx264 @ 0x9f9f600] ref B L0: 86.0% 11.4%  2.6%
[libx264 @ 0x9f9f600] ref B L1: 94.4%  5.6%
[libx264 @ 0x9f9f600] kb/s:180.15

~/camera/solar/editing$ ffmpeg -f concat -i concat-list-3297.txt -c copy 
20160915_ConPus-250A-breaker-replacementTests_3297-0828-360.mov
ffmpeg version 3.1.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr/local --enable-gpl --enable-postproc 
--enable-swscale --enable-libmp3lame --enable-libvorbis --enable-libx264 
--enable-pthreads --enable-libopenjpeg --enable-nonfree 
--disable-ffserver --disable-network --enable-libfreetype 
--enable-libfontconfig --disable-doc --disable-htmlpages 
--disable-podpages --enable-shared --enable-libvpx 
--extra-cflags=-I/usr/include --extra-ldflags=-L/usr/lib/i386-linux-gnu
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x98402e0] Auto-inserting h264_mp4toannexb 
bitstream filter
Input #0, concat, from 'concat-list-3297.txt':
  Duration: N/A, start: 0.000000, bitrate: 2272 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), 
yuvj420p(pc), 640x360, 736 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.48.101 libx264
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 
stereo, s16, 1536 kb/s
    Metadata:
      handler_name    : DataHandler
File '20160915_ConPus-250A-breaker-replacementTests_3297-0828-360.mov' 
already exists. Overwrite ? [y/N] y
[mov @ 0x98463e0] Using AVStream.codec to pass codec parameters to 
muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mov, to 
'20160915_ConPus-250A-breaker-replacementTests_3297-0828-360.mov':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuvj420p(pc), 
640x360, q=2-31, 736 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.48.101 libx264
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 
stereo, 1536 kb/s
    Metadata:
      handler_name    : DataHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x98402e0] Auto-inserting h264_mp4toannexb 
bitstream filter
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x98402e0] Auto-inserting h264_mp4toannexb 
bitstream filterd= 156x   
[mov @ 0x98463e0] Non-monotonous DTS in output stream 0:0; previous: 
2577575, current: 1030432; changing to 2577576. This may result in 
incorrect timestamps in the output file.
[mov @ 0x98463e0] Non-monotonous DTS in output stream 0:0; previous: 
2577576, current: 1030832; changing to 2577577. This may result in 
incorrect timestamps in the output file.
....clip looks same as before.


Am I doing something in the wrong order in the command line, or ...?
Stewart



More information about the ffmpeg-user mailing list