FFmpeg: Convert MP4 with SRT Subtitles to M3U8 & Split into 5MB Segments
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:\n\n\nffmpeg -i input.mp4 -vf subtitles=input.srt -c:v libx264 -c:a aac -hls_time 10 -hls_segment_size 5M output.m3u8\n\n\nHere's a breakdown of the command and its options:\n\n- -i input.mp4: Specifies the input MP4 video file.\n- -vf subtitles=input.srt: Specifies the input SRT subtitle file.\n- -c:v libx264: Sets the video codec to H.264 for the output.\n- -c:a aac: Sets the audio codec to AAC for the output.\n- -hls_time 10: Sets the duration of each segment in the M3U8 file to 10 seconds. Adjust this value according to your requirements.\n- -hls_segment_size 5M: Sets the maximum segment size for the M3U8 file to 5MB. Adjust this value according to your requirements.\n- output.m3u8: Specifies the output M3U8 file.\n\nMake 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/psFM 著作权归作者所有。请勿转载和采集!