0

I tried to extract and transcode audio tracks from video, but I got an error: Filter split:output1 has an unconnected output. How to fix this problem?

ffmpeg command:

ffmpeg -i video.mp4 -filter_complex [0]split=2[s0][s1] -map [s0] -c:a aac -dn -map -0:v? -map 0:1 -map_chapters -1 -map_metadata -1 -sn video-0.aac -map [s1] -ac 2 -c:a aac -dn -map -0:v? -map 0:2 -map_chapters -1 -map_metadata -1 -sn video-1.aac -y

fprobe full output (strip information about chapters):

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : SomeTitle
    encoder         : Lavf58.45.100
  Duration: 00:21:35.58, start: 0.000000, bitrate: 10591 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 70.000000
      Metadata:
        title           : Chapter 1
...
...
    Chapter #0:20: start 1278.000000, end 1295.584000
      Metadata:
        title           : Last Chapter
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 9754 kb/s, 23.98 fps, 23.98 tbr, 16k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(rus): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main
  Stream #0:2(eng): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main
  Stream #0:3(eng): Data: bin_data (text / 0x74786574), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
Mentos
  • 168
  • 12

1 Answers1

2

2 problems:

  1. split filter is for video. If you want to split audio use asplit.
  2. You are trying to put video into AAC, but AAC is audio only.

Simplified example; assuming you want audio #0 in output-0.aac and audio #1 in output-1.aac:

ffmpeg -i video.mp4 -map 0:a:0 -map_chapters -1 -map_metadata -1 output-0.aac -map 0:a:1 -map_chapters -1 -map_metadata -1 output-1.aac

See FFmpeg Wiki: Map for more info about -map.

llogan
  • 121,796
  • 28
  • 232
  • 243