I have 2 ffmpeg commands working fine alone

ffmpeg -i test_video.mp4 -vcodec libx264 -filter_complex "drawtext=fontfile=test.ttf:text=awesome:fontcolor=white:fontsize=20:x=0:y=10+th"  test_video_text.mp4 -y


ffmpeg -i test_video.mp4 -vcodec libx264 -filter_complex "volume=0"  test_video_text.mp4 -y

when merged these commands as

ffmpeg -i test_video.mp4 -vcodec libx264 -filter_complex "drawtext=fontfile=Lato-Light.ttf:text=awesome:fontcolor=white:fontsize=20:x=0:y=10+th,volume=0"  test_video_text.mp4 -y

Getting the following error :

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_video.mp4':
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp41mp42isom
    creation_time   : 2015-09-24 18:32:33
  Duration: 00:00:09.87, start: 0.068254, bitrate: 235 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x320, 183 kb/s, 29.67 fps, 29.67 tbr, 29673 tbn, 59.35 tbc (default)
      creation_time   : 2015-09-24 18:32:33
      handler_name    : Core Media Video
    Stream #0:1(und): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 48 kb/s (default)
      creation_time   : 2015-09-24 18:32:33
      handler_name    : Core Media Audio
[Parsed_drawtext_0 @ 0x7f814af06260] Media type mismatch between the 'Parsed_drawtext_0' filter output pad 0 (video) and the 'Parsed_volume_1' filter input pad 0 (audio)
[AVFilterGraph @ 0x7f814ae00360] Cannot create the link drawtext:0 -> volume:0
Error initializing complex filters.
Invalid argument

Kindly someone help me what i am doing wrong ?


If you have a complex filter with more than one input and output, you need to explicitly specify which input and output streams are used by which filter. Also, to separate filterchains, you will have to use the semicolon (;) instead of a simple comma (,). Finally, you have to map the output of those filterchains to the output file using the -map option.

ffmpeg -y -i test_video.mp4 -vcodec libx264 -filter_complex \
   -map "[outv]" -map "[outa]"\

I inserted backslashes for better readability. See the filtergraph and filter_complex documentation for more details.

Also, since -y is a global option, you should move it to the beginning of the command.

  • Awesome @slhck can you kindly give the summary what does this do -map "[outv]" -map "[outa]" ? – user1640954 Apr 27 '16 at 15:42
  • It basically says, use these two outputs from the filter for the output file. – slhck May 1 '16 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.