[FFmpeg-user] Need to Convert MP4 (or MKV) with AAC *and* AC-3 Audio to Multi-Rendition HLS (each with *both* audio streams)
Moritz Barsnick
barsnick at gmx.net
Thu Sep 1 09:26:36 EEST 2022
Hi Clay,
On Tue, Aug 30, 2022 at 18:51:13 -0400, Clay wrote:
> If you have a better way to achieve this, I am ***all ears***.
> Here is the code I have so far:
I think you need to fix your command line in various places:
> ffmpeg -i ../InputFile-1920x804-24f.mp4 \
> -filter_complex "[0:v]split=4[v1][v2][v3][v4]; [v1]copy[v1out];
> [v2]scale=w=1280:h=536[v2out]; [v3]scale=w=720:h=300[v3out];
> [v4]scale=w=480:h=200[v4out]"\
> -map [v1out] -c:v:0 libx264 -x264-params -b:v:0 -maxrate:v:0 4M
"-x264-params" needs an argument - that's missing here.
"-b:v:0" needs an argument - that's missing here.
And for bash's sake, I believe you need to quote "[v1out]" and the
similar ones below (but I may be overambitious here).
> -minrate:v:0 4M -bufsize:v:0 4M -crf 17 -preset slower -g 48
> -sc_threshold 0 -keyint_min 48 \
> -map [v2out] -c:v:1 libx264 -x264-params -b:v:1 -maxrate:v:1 3M
> -minrate:v:1 3M -bufsize:v:1 3M -crf 17 -preset slower -g 48
> -sc_threshold 0 -keyint_min 48 \
> -map [v3out] -c:v:2 libx264 -x264-params -b:v:2 -maxrate:v:2 2M
> -minrate:v:2 2M -bufsize:v:2 2M -crf 17 -preset slower -g 48
> -sc_threshold 0 -keyint_min 48 \
> -map [v4out] -c:v:3 libx264 -x264-params -b:v:3 -maxrate:v:3 1M
> -minrate:v:3 1M -bufsize:v:3 1M -crf 17 -preset slower -g 48
> -sc_threshold 0 -keyint_min 48 \
> -map 0:a -c:a:0 \
> -map 0:a -c:a:1 \
> -map 0:a -c:a:2 \
> -map 0:a -c:a:3 \
"-c:a:x" needs an argument.
> -f hls \
> -hls_time 2 \
> -hls_playlist_type vod \
> -hls_flags independent_segments \
> -hls_segment_type mpegts \
> -hls_segment_filename OutputFile_%v/data%02d.ts \
> -master_pl_name master.m3u8 \
> -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 v:3,a:3"OutputFile_%v.m3u8
> This code breaks when I attempt to run it, giving the following error:
> [NULL @ 0x55f0357bbd40] Unable to find a suitable output format for '0:a'
> 0:a: Invalid argument
Probably because ffmpeg's whole option parsing is messed up due to your
missing arguments.
> I have tried many varieties of the audio stream mapping... 0:a, a:0,
> a:0:1.. etc.
And this is not the actual issue.
Cheers,
Moritz
More information about the ffmpeg-user
mailing list