[FFmpeg-user] Splitting output from -filter_complex and losing audio

Sean seanm at goldeneraproductions.org
Wed Dec 18 09:57:21 CET 2013


I need to set up an ffmpeg command string that will allow me to take a
single input file (contains video and audio) and output it to 2 different
mp4 files at different resolutions and bitrates. There is a filter process
that needs to take place right before the encode process to deinterlace and
crop the edges of the video. I am using the -filter_complex option so that
the process only has to deinterlace and crop once and feed that out to the 2
encoders through the split filter. This all works great except that the [a]
and [b] split outputs only contain video and no audio coming out of
-filter_complex. How can I get the audio from the input file mapped into [a]
and [b] or to feed into each of the encoders? 



ffmpeg.exe -i MyVideo.mov -filter_complex "[0]
yadif,crop=in_w-2*58:in_h-2*32,split=2 [a][b]" -map "[a]" -s 640x360
-pix_fmt yuv420p -vcodec libx264 -preset medium -crf 18 -maxrate 700k
-bufsize 2100k -movflags +faststart -acodec libvo_aacenc -b:a 128k
MyVideo_640.mp4 -map "[b]" -s 576x324 -pix_fmt yuv420p -vcodec libx264
-preset medium -crf 18 -maxrate 600k -bufsize 1800k -movflags +faststart
-acodec libvo_aacenc -b:a 96k MyVideo_576.mp4

ffmpeg version N-54960-gf3f4e13 Copyright (c) 2000-2013 the FFmpeg
developers
  built on Jul 26 2013 19:21:01 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --
enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --ena
ble-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-libr
tmp --enable-libschroedinger --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 19.100 / 55. 19.100
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.103 /  3. 81.103
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.2 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MyVideo.mov
':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2013-04-18 17:55:58
    timecode        : 00:59:58;00
  Duration: 00:00:55.96, start: 0.000000, bitrate: 146958 kb/s
    Stream #0:0(eng): Video: dnxhd (AVdn / 0x6E645641), yuv422p, 1920x1080,
145344 kb/s, 29.97 fps, 29.97 tbr, 29970 tbn, 29970 tbc
    Metadata:
      creation_time   : 2013-04-18 17:55:58
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      creation_time   : 2013-04-18 17:55:58
      handler_name    : Apple Alias Data Handler
      timecode        : 00:59:58;00
    Stream #0:2(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
stereo, s16, 1536 kb/s
    Metadata:
      creation_time   : 2013-04-18 17:55:58
      handler_name    : Apple Alias Data Handler
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0
(MyVideo_640.mp4) 
has not been used for any stream. The most likely reason is either wrong
type (e.g. a video option with no video streams) or that it
 is a private option of some encoder which was not actually used for any
stream.
Codec AVOption b (set bitrate (in bits/s)) specified for output file #1
(MyVideo_576.mp4) 
has not been used for any stream. The most likely reason is either wrong
type (e.g. a video option with no video streams) or that it
 is a private option of some encoder which was not actually used for any
stream.
[libx264 @ 00000000047b4320] using cpu capabilities: MMX2 SSE2Fast SSSE3
Cache64 SlowShuffle
[libx264 @ 00000000047b4320] profile High, level 3.0
[libx264 @ 00000000047b4320] 264 - core 135 r2345 f0c1c53 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2013 - 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=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=18.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=700 vbv_bufsize=210
0 crf_max=0.0 nal_hrd=none ip_ratio=1.40 aq=1:1.00
[libx264 @ 000000000257a740] using cpu capabilities: MMX2 SSE2Fast SSSE3
Cache64 SlowShuffle
[libx264 @ 000000000257a740] profile High, level 3.0
[libx264 @ 000000000257a740] 264 - core 135 r2345 f0c1c53 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2013 - 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=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=18.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=600 vbv_bufsize=180
0 crf_max=0.0 nal_hrd=none ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'MyVideo_640.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    timecode        : 00:59:58;00
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
640x360, q=-1--1, max. 700 kb/s, 11988 tbn, 29.97 tbc
Output #1, mp4, to 'MyVideo_576.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    timecode        : 00:59:58;00
    encoder         : Lavf55.12.102
    Stream #1:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
576x324, q=-1--1, max. 600 kb/s, 11988 tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 (dnxhd) -> yadif
  split:output0 -> Stream #0:0 (libx264)
  split:output1 -> Stream #1:0 (libx264)
Press [q] to stop, [?] for help
[swscaler @ 00000000047daf60] Warning: data is not aligned! This can lead to
a speedloss
[mp4 @ 0000000002571840] Starting second pass: moving header on top of the
fileate=N/A
[mp4 @ 0000000002579f60] Starting second pass: moving header on top of the
file
frame= 1678 fps= 33 q=-1.0 Lq=-1.0 size=    4520kB time=00:00:55.92 bitrate=
662.1kbits/s
video:8344kB audio:0kB subtitle:0 global headers:0kB muxing overhead
-45.830907%
[libx264 @ 00000000047b4320] frame I:19    Avg QP:18.24  size: 29670
[libx264 @ 00000000047b4320] frame P:572   Avg QP:21.25  size:  5244
[libx264 @ 00000000047b4320] frame B:1087  Avg QP:24.03  size:   960
[libx264 @ 00000000047b4320] consecutive B-frames:  5.4% 16.3% 24.9% 53.4%
[libx264 @ 00000000047b4320] mb I  I16..4: 10.1% 60.0% 29.9%
[libx264 @ 00000000047b4320] mb P  I16..4:  2.2%  3.4%  0.5%  P16..4: 43.1%
19.4% 11.0%  0.0%  0.0%    skip:20.3%
[libx264 @ 00000000047b4320] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8: 39.3%
2.9%  0.6%  direct: 1.1%  skip:56.0%  L0:39.9% L1:54.6% BI: 5.5
%
[libx264 @ 00000000047b4320] 8x8 transform intra:57.2% inter:76.9%
[libx264 @ 00000000047b4320] coded y,uvDC,uvAC intra: 53.3% 75.0% 45.4%
inter: 14.1% 19.2% 1.6%
[libx264 @ 00000000047b4320] i16 v,h,dc,p: 35% 23%  5% 36%
[libx264 @ 00000000047b4320] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 19% 18%  4%
6%  7%  7%  6%  6%
[libx264 @ 00000000047b4320] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 15% 10%  5%
8%  9%  8%  7%  6%
[libx264 @ 00000000047b4320] i8c dc,h,v,p: 40% 28% 19% 12%
[libx264 @ 00000000047b4320] Weighted P-Frames: Y:19.2% UV:13.6%
[libx264 @ 00000000047b4320] ref P L0: 58.6% 17.1% 16.9%  6.7%  0.6%
[libx264 @ 00000000047b4320] ref B L0: 87.2% 10.6%  2.2%
[libx264 @ 00000000047b4320] ref B L1: 93.3%  6.7%
[libx264 @ 00000000047b4320] kb/s:658.29
[libx264 @ 000000000257a740] frame I:19    Avg QP:18.12  size: 25911
[libx264 @ 000000000257a740] frame P:569   Avg QP:21.20  size:  4532
[libx264 @ 000000000257a740] frame B:1090  Avg QP:24.07  size:   793
[libx264 @ 000000000257a740] consecutive B-frames:  4.5% 17.3% 28.4% 49.8%
[libx264 @ 000000000257a740] mb I  I16..4:  9.5% 57.5% 33.0%
[libx264 @ 000000000257a740] mb P  I16..4:  2.1%  3.2%  1.0%  P16..4: 42.5%
20.0% 11.3%  0.0%  0.0%    skip:20.0%
[libx264 @ 000000000257a740] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8: 39.1%
3.0%  0.5%  direct: 1.1%  skip:56.2%  L0:39.8% L1:54.0% BI: 6.2
%
[libx264 @ 000000000257a740] 8x8 transform intra:53.4% inter:74.8%
[libx264 @ 000000000257a740] coded y,uvDC,uvAC intra: 53.8% 76.3% 47.1%
inter: 14.0% 18.7% 1.8%
[libx264 @ 000000000257a740] i16 v,h,dc,p: 40% 20%  5% 34%
[libx264 @ 000000000257a740] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 18% 17%  4%
6%  7%  7%  6%  6%
[libx264 @ 000000000257a740] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 13%  9%  5%
7%  8%  7%  6%  5%
[libx264 @ 000000000257a740] i8c dc,h,v,p: 39% 26% 23% 12%
[libx264 @ 000000000257a740] Weighted P-Frames: Y:18.3% UV:13.0%
[libx264 @ 000000000257a740] ref P L0: 58.7% 17.6% 16.2%  6.9%  0.6%
[libx264 @ 000000000257a740] ref B L0: 86.8% 10.9%  2.3%
[libx264 @ 000000000257a740] ref B L1: 92.7%  7.3%
[libx264 @ 000000000257a740] kb/s:562.36


Tku.

-Sean






More information about the ffmpeg-user mailing list