how to ffmpeg auto transfer from mp4 with srt file subtitle to m3u8 and split file to 5mb and with subtitle word style
To auto transfer an MP4 file with an SRT subtitle to an M3U8 format, split the file into 5MB segments, and include subtitle word style, you can use the following FFmpeg command:
ffmpeg -i input.mp4 -vf "subtitles=input.srt:force_style='Fontname=Arial,Fontsize=24,PrimaryColour=&H0000ff&'" -c:v libx264 -c:a aac -hls_time 10 -hls_segment_size 5000000 output.m3u8
Here's a breakdown of the command:
-i input.mp4: Specifies the input MP4 file.-vf "subtitles=input.srt:force_style='Fontname=Arial,Fontsize=24,PrimaryColour=&H0000ff&'": Applies the SRT subtitle to the video with specified subtitle style. Replaceinput.srtwith the path to your SRT file, and modify theforce_styleparameters to match your desired subtitle style.-c:v libx264 -c:a aac: Sets the video codec to H.264 (libx264) and the audio codec to AAC, which are commonly used for M3U8 format.-hls_time 10: Sets the segment duration to 10 seconds. Adjust this value as per your requirements.-hls_segment_size 5000000: Sets the maximum segment size to 5MB (5,000,000 bytes). Adjust this value as per your requirements.output.m3u8: Specifies the output M3U8 file.
Make sure you have FFmpeg installed and configured on your system before running this command
原文地址: https://www.cveoy.top/t/topic/hJBJ 著作权归作者所有。请勿转载和采集!