-->

Ffmpeg creating m3u8 from mp4, video file size

2020-07-23 04:41发布

问题:

I am using ffmpeg to convert mp4 to m3u8. But first I need to make mp4 smaller. I use this code to make it smaller:

ffmpeg -i big.mp4 -b 1000000 small.mp4

Then I use this code to convert it to m3u8

ffmpeg -i small.mp4 -g 60 -hls_time 2 -hls_list_size 0 -hls_segment_size 500000 output.m3u8

Is there a way to do this in once?

回答1:

Just combine them:

ffmpeg -i big.mp4 -b:v 1M -g 60 -hls_time 2 -hls_list_size 0 -hls_segment_size 500000 output.m3u8

Note that you're transcoding the video twice in your current workflow. Since the 2nd command hasn't set video codec option to copy, it gets transcoded again - in CRF mode with value 23.



回答2:

I tried to do that :

ffmpeg -i flir_20191202T174341.mp4 -b:v 1M -g 60 -hls_time 2
-hls_list_size 0 -hls_segment_size 500000 output.m3u8

But I have an error :

Too many packets buffered for output stream 0:1.
[aac @ 0x7ff2fc00d800] Qavg: 1053.251
[aac @ 0x7ff2fc00d800] 2 frames left in the queue on closing
Conversion failed!

How can I to to convert my mp4 video to m3u8 ?