2
votes

I have successfully output 3 HLS output using -map 360, 720 & 1080p. My source file is 540p. once generated I use ffprobe on the newly created 360.ts, 720.ts, and 1080.ts and notice that there is a second video channel. This channel is the input video. How do I have FFmpeg not output the original video as part of the output?

this is the ffprobe on 360.ts

Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Stream #0:10x101: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 100 kb/s Stream #0:2[0x102]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

This is the FFmpeg command

%ffmpeg% -loglevel fatal -threads %threads% -hide_banner -y -i %input% -i %overlayImg%^ -filter_complex "[1]colorchannelmixer=aa=%thumbopacity%,scale=iw*%thumbscale%:-1[wm];[0:v][wm]overlay=(main_w-overlay_w)-36:(main_h-overlay_h)-21,split=4[a][b][c][d];[a]scale=w=640:h=360:force_original_aspect_ratio=decrease[a];[b]scale=w=1280:h=720:force_original_aspect_ratio=decrease[b];[c]scale=w=1920:h=1080:force_original_aspect_ratio=decrease[c];[d]scale=w=1280:h=720:force_original_aspect_ratio=decrease[d]"^ -map "[a]" -map 0 -c:a aac -ar 48000 -c:v h264 -profile:v main -movflags +faststart -tune film -crf %crf% -preset %preset% -sc_threshold 0 -g 72 -keyint_min 72 -hls_time 4 -hls_playlist_type vod -b:v 800k -maxrate 856k -bufsize 1200k -b:a 96k -hls_flags single_file^ %output%\360p.m3u8^ -map "[b]" -map 0 -c:a aac -ar 48000 -c:v h264 -profile:v main -movflags +faststart -tune film -crf %crf% -preset %preset% -sc_threshold 0 -g 72 -keyint_min 72 -hls_time 4 -hls_playlist_type vod -b:v 2800k -maxrate 2996k -bufsize 4200k -b:a 128k -hls_flags single_file^ %output%\720p.m3u8^ -map "[c]" -map 0 -c:a aac -ar 48000 -c:v h264 -profile:v main -movflags +faststart -tune film -crf %crf% -preset %preset% -sc_threshold 0 -g 72 -keyint_min 72 -hls_time 4 -hls_playlist_type vod -b:v 5000k -maxrate 5350k -bufsize 7500k -b:a 192k -hls_flags single_file^ %output%\1080p.m3u8^ -map "[d]" -map 0 -c:a aac -ar 48000 -c:v h264 -profile:v main -preset %preset%^ %output%\720.mp4^ -map 0:v -y -ss 0.5 -vframes 1 -s %thumbsize% -ss 30^ %outputthumb%

thank you.

1

1 Answers

0
votes

1) -map 0 will include all original streams, including the video. Change to -map 0:a

2) You don't need to scale to 720p twice. scale once and split.

3) b:v and crf are exclusive in libx264 (h264 encoder). Pick one (crf is preferable)

Use

%ffmpeg% -loglevel fatal -threads %threads% -hide_banner -y -i %input% -i %overlayImg%^ -filter_complex "[1]colorchannelmixer=aa=%thumbopacity%,scale=iw*%thumbscale%:-1[wm];[0:v][wm]overlay=(main_w-overlay_w)-36:(main_h-overlay_h)-21,split=4[a][b][c][d];[a]scale=w=640:h=360:force_original_aspect_ratio=decrease[a];[b]scale=w=1280:h=720:force_original_aspect_ratio=decrease,split=2[b][d];[c]scale=w=1920:h=1080:force_original_aspect_ratio=decrease[c]"^ -map "[a]" -map 0:a -c:a aac -ar 48000 -c:v h264 -profile:v main -movflags +faststart -tune film -crf %crf% -preset %preset% -sc_threshold 0 -g 72 -keyint_min 72 -hls_time 4 -hls_playlist_type vod -b:v 800k -maxrate 856k -bufsize 1200k -b:a 96k -hls_flags single_file^ %output%\360p.m3u8^ -map "[b]" -map 0:a -c:a aac -ar 48000 -c:v h264 -profile:v main -movflags +faststart -tune film -crf %crf% -preset %preset% -sc_threshold 0 -g 72 -keyint_min 72 -hls_time 4 -hls_playlist_type vod -b:v 2800k -maxrate 2996k -bufsize 4200k -b:a 128k -hls_flags single_file^ %output%\720p.m3u8^ -map "[c]" -map 0:a -c:a aac -ar 48000 -c:v h264 -profile:v main -movflags +faststart -tune film -crf %crf% -preset %preset% -sc_threshold 0 -g 72 -keyint_min 72 -hls_time 4 -hls_playlist_type vod -b:v 5000k -maxrate 5350k -bufsize 7500k -b:a 192k -hls_flags single_file^ %output%\1080p.m3u8^ -map "[d]" -map 0:a -c:a aac -ar 48000 -c:v h264 -profile:v main -preset %preset%^ %output%\720.mp4^ -map 0:v -y -ss 0.5 -vframes 1 -s %thumbsize% -ss 30^ %outputthumb%