简体   繁体   English

如何从 mp4 视频创建视频块 (.ts) 和 .m3u8 文件?

[英]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.

相关问题 如何从mp4视频URL(存储在亚马逊S3中)创建m3u8播放列表,并将视频块(.ts文件)和.m3u8文件存储回另一个S3? - How to create m3u8 playlist from mp4 video url ( stored in amazon S3 ) and store the video chunks ( .ts files) and .m3u8 file back to another S3? linux: m3u8: 如何从 .m3u8 中列出的段手动下载和创建 mp4 - linux: m3u8: how to manually download and create an mp4 from segments listed in .m3u8 无法将从.m3u8 文件下载的.ts 文件转换为mp4 - Can't convert .ts files that downloaded from .m3u8 file to mp4 如何将 mp4 视频转换为 (.m3u8) 播放列表 nodejs - How to convert mp4 Video to (.m3u8) playlist nodejs ffmpeg 从 mp4 创建 m3u8,视频文件大小 - Ffmpeg creating m3u8 from mp4, video file size 通过 node.js 将 mp4 转换为 m3u8 后,第一个 m3u8 ts 段不工作 - first m3u8 ts segment not working after mp4 to m3u8 conversion by node js FFmpeg 节点js将视频文件(.mp4)转换为m3u8:Output格式m3u8不可用 - FFmpeg node js convert video file (.mp4) to m3u8 : Output format m3u8 is not available 将HLS M3U8转成MP4后,如何查出原来是否有TS段丢失? - After converting an HLS M3U8 into an MP4, how to find out if there were TS segments missing, originally? 从 ts 文件列表创建 m3u8 文件 - Create m3u8 file from list of ts files 如何使用nodejs在ffmpeg中将mp4视频转换为m3u8 - How To covert mp4 video to m3u8 in ffmpeg using nodejs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM