how to ffmpeg auto transfer from mp4 with srt file subtitle to m3u8 and split file to 5mb
To automatically transfer an MP4 video with an SRT subtitle file to an M3U8 format and split the resulting file into 5MB segments using FFmpeg, you can use the following command:
ffmpeg -i input.mp4 -vf subtitles=input.srt -c:v libx264 -c:a aac -hls_time 10 -hls_segment_size 5M output.m3u8
Here's a breakdown of the command and its options:
-i input.mp4: Specifies the input MP4 video file.-vf subtitles=input.srt: Specifies the input SRT subtitle file.-c:v libx264: Sets the video codec to H.264 for the output.-c:a aac: Sets the audio codec to AAC for the output.-hls_time 10: Sets the duration of each segment in the M3U8 file to 10 seconds. Adjust this value according to your requirements.-hls_segment_size 5M: Sets the maximum segment size for the M3U8 file to 5MB. Adjust this value according to your requirements.output.m3u8: Specifies the output M3U8 file.
Make sure you have FFmpeg installed on your system and properly set up in the command line environment before executing this command
原文地址: https://www.cveoy.top/t/topic/hJBG 著作权归作者所有。请勿转载和采集!