how to ffmpeg auto transfer from mp4 with srt file subtitle to m3u8
To convert an MP4 video with an SRT subtitle file to an M3U8 format using FFmpeg, you can use the following command:
ffmpeg -i input.mp4 -vf "subtitles=input.srt" -c:v libx264 -c:a copy -hls_time 10 -hls_list_size 0 output.m3u8
Here's a breakdown of the command:
-i input.mp4: Specifies the input MP4 video file.-vf "subtitles=input.srt": Adds the SRT subtitle file to the video using thesubtitlesvideo filter.-c:v libx264: Sets the video codec to H.264.-c:a copy: Copies the audio codec without re-encoding.-hls_time 10: Sets the segment duration for the M3U8 file to 10 seconds. You can adjust this value as needed.-hls_list_size 0: Sets the playlist length to unlimited, meaning all segments will be included in the M3U8 file.output.m3u8: Specifies the output M3U8 file.
Make sure to replace input.mp4 with the path to your input video file and input.srt with the path to your SRT subtitle file. Also, specify the desired output filename for the M3U8 file.
Note: FFmpeg needs to be installed on your system to use this command
原文地址: https://www.cveoy.top/t/topic/hJBx 著作权归作者所有。请勿转载和采集!