gpt4 book ai didi

ffmpeg - 如何每个 HLS 输出只输出一个视频流

转载 作者:行者123 更新时间:2023-12-04 22:50:24 25 4
gpt4 key购买 nike

我已经使用 -map 360、720 和 1080p 成功输出了 3 个 HLS 输出。我的源文件是 540p。生成后,我在新创建的 360.ts、720.ts 和 1080.ts 上使用 ffprobe,并注意到有第二个视频 channel 。该 channel 是输入视频。如何让 FFmpeg 不将原始视频作为输出的一部分输出?

这是 360.ts 上的 ffprobe

流 #0:0[0x100]:视频:h264(主)([27][0][0][0]/0x001B),yuv420p,640x360 [SAR 1:1 DAR 16:9],29.97 fps,29.97 tbr,90k tbn,59.94 tbc
流 #0:10x101:音频:aac ([15][0][0][0]/0x000F),48000 Hz,立体声,fltp,100 kb/s
流 #0:2[0x102]:视频:h264(主)([27][0][0][0]/0x001B),yuv420p,960x540 [SAR 1:1 DAR 16:9],29.97 fps,29.97 tbr,90k tbn,59.94 tbc

这是 FFmpeg 命令

%ffmpeg% -loglevel 致命 -threads %threads% -hide_banner -y -i %input% -i %o​​verlayImg%^
-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^
%输出%\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^
%输出%\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^
%输出%\1080p.m3u8^
-map "[d]"-map 0 -c:a aac -ar 48000 -c:v h264 -profile:v main -preset %preset%^
%输出%\720.mp4^
-map 0:v -y -ss 0.5 -vframes 1 -s %thumbsize% -ss 30^
%输出拇指%

谢谢你。

最佳答案

1) -map 0将包括所有原始流,包括视频。更改为 -map 0:a
2)您不需要缩放到 720p 两次。缩放一次并拆分。

3) b:vcrf在 libx264(h264 编码器)中是专有的。选择一个(最好是crf)

利用

%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%

关于ffmpeg - 如何每个 HLS 输出只输出一个视频流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52900512/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com