问题
Here are a few commands I am using to convert and transize a video in mp4 format to a m3u8 playlist.
For a given input video (mp4 format), generate multiple video only segments with segment duration 30s
ffmpeg -loglevel error -i input.mp4 -dn -sn -an -c:v copy -bsf:v h264_mp4toannexb -copyts -start_at_zero -f segment -segment_time 30 30%03d.mp4 -dn -sn -vn -c:a copy audio.aac
Apply video filter (in this case scaling) on each segment and convert it to a m3u8 format
ls 30*.mp4 | parallel 'ffmpeg -loglevel error -i {} -vf scale=-2:144 -hls_list_size 0 {}.m3u8'
Store the list of m3u8 files generated in list.txt
in this format file 'segment-name.m3u8'
for f in 30*.m3u8; do echo "file '$f'" >> list.txt; done
Using concat demuxer, combine all segment files (which are in m3u8 format) and the audio to get one final m3u8 playlist pointing to segments with duration of 10s.
ffmpeg -loglevel error -f concat -i list.txt -i audio.aac -c copy -hls_list_size 0 -hls_time 10 output_30.m3u8
I can change the segment duration in the first step from 30s to 60s, and compare the md5 of the final m3u8 playlist generated in both the cases using this command
ffmpeg -loglevel error -i <input m3u8 playlist> -f md5 -
The md5 of the output files differ i.e video streams of output_30.m3u8
and output_60.m3u8
are not the same.
Can anyone elaborate on this?
(I expected the md5 to be the same)
回答1:
m3u8 is just a text file. Run diff on them, and it will tell you exactly what is different.
来源:https://stackoverflow.com/questions/62474057/ffmpeg-md5-of-m3u8-playlists-generated-from-same-input-video-with-different-se