[FFmpeg-user] Syntax issue with audio filter

Marc marcfflist at vq5.net
Fri Mar 6 10:11:24 CET 2015


The answer it turns out is to use filter_complex:

ffmpeg -report -loglevel verbose -y -i "input.mkv" -filter_complex
"[0:a:language:eng]pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR[dp]"
-map 0:v:0 -map 0:a:language:eng -map "[dp]" -map 0:s -c:v:0 copy -c:a:0
copy -c:a:1 ac3 -ab:2 192k -ac:2 2 -c:s copy "output.mkv"

On 3 March 2015 at 15:41, Marc <marcfflist at vq5.net> wrote:

> I have a video file that looks like this:
>
> $ ffmpeg -i "input.mkv"
> ffmpeg version 2.5.4 Copyright (c) 2000-2015 the FFmpeg developers
>   built on Feb 15 2015 21:42:49 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
> ---snip---
>     Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x800 [SAR 1:1
> DAR 12:5], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
>     Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp,
> 1536 kb/s (default)
>     Stream #0:2(eng): Subtitle: subrip (default)
>     Metadata:
>       title           : Forced
>     Stream #0:3(eng): Subtitle: subrip
>     Stream #0:4(eng): Subtitle: subrip
>     Metadata:
>       title           : SDH
>
> So that's one video stream, one DTS audio stream and three subtitle
> streams.
> I want to create a copy that has all the same streams but add a
> two-channel ac3 stream encoded from the existing DTS audio stream.
> This is pretty easy to do:
>
> $ ffmpeg -report -loglevel verbose -y -i "input.mkv" -map 0:v:0 -c:v:0
> copy -map 0:a:language:eng -c:a:0 copy -map 0:a:language:eng -c:a:1
> ac3 -ab 192k -ac 2 -map 0:s -c:s copy "output.mkv"
> --snip--
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
>   Stream #0:1 -> #0:1 (copy)
>   Stream #0:1 -> #0:2 (dts (dca) -> ac3 (native))
>   Stream #0:2 -> #0:3 (copy)
>   Stream #0:3 -> #0:4 (copy)
>   Stream #0:4 -> #0:5 (copy)
> Press [q] to stop, [?] for help
> q
>
> We can see in the output above that I'm keeping the existing streams
> and adding an audio (ac3) stream.
>
> So far so good, but then I wanted to tune the sound in the new stream
> with an audio filter, using a single -af parameter:
>
> $ ffmpeg -report -loglevel verbose -y -i "input.mkv" -map 0:v:0 -c:v:0
> copy -map 0:a:language:eng -c:a:0 copy -map 0:a:language:eng -c:a:1
> ac3 -ab 192k -ac 2 -af
> "pan=stereo:FL=FC+0.30*FL+0.30*BL:FR=FC+0.30*FR+0.30*BR" -map 0:s -c:s
> copy "output.mkv"
> --snip--
> Filtergraph 'pan=stereo:FL=FC+0.30*FL+0.30*BL:FR=FC+0.30*FR+0.30*BR'
> was defined for audio output stream 0:1 but codec copy was selected.
> Filtering and streamcopy cannot be used together.
> $ echo $?
> 1
>
> I don't understand why I'm seeing this error message, it seems that
> ffmpeg has confused the two audio streams, the first one is indeed a
> copy, but the second (to which I'm applying the filter) is not.
>
> Have I stumbled on a syntax-parsing bug. Or am I just doing something
> stupid?
>
> Thanks,
> Marc.
>


More information about the ffmpeg-user mailing list