[英]How to create chunks of videos (.ts) and .m3u8 file from a mp4 video?
I need to create chunks of videos ( .ts
) of fixed duration (say 5 or 10 seconds) from a mp4 video.我需要从 mp4 视频创建固定持续时间(比如 5 或 10 秒)的视频块 (
.ts
)。 And also I need the chunks in different formats (260p, 480p, 720p, 1080p).而且我还需要不同格式的块(260p、480p、720p、1080p)。
I'm able to create the chunks and m3u8 using the command below:我可以使用以下命令创建块和 m3u8:
ffmpeg -i input.mp4 -g 60 -hls_time 10 out.m3u8
but not able to create for different resolutions as mentioned above.但无法为上面提到的不同分辨率创建。
Use the scale filter and the HLS muxer :使用比例过滤器和HLS 多路复用器:
ffmpeg -i input.mp4 -filter_complex "[0]scale=-2:260[260];[0]scale=-2:480[480];[0]scale=-2:720[720];[0]scale=-2:1080[1080]" -map "[260]" -map 0:a -map "[480]" -map 0:a -map "[720]" -map 0:a -map "[1080]" -map 0:a -f hls -hls_time 10 -var_stream_map "v:0,a:0,name:260 v:1,a:1,name:480 v:2,a:2,name:720 v:3,a:3,name:1080" -hls_segment_filename "%v_%03d.ts" -master_pl_name "master.m3u8" "output_%v.m3u8"
If you get this error then you need to upgrade your ffmpeg如果您收到此错误,则需要升级您的 ffmpeg
Unrecognized option 'var_stream_map'.无法识别的选项“var_stream_map”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.