简体   繁体   English

使用 ffmpeg 将 Mp4 转换为具有多个比特率的动态自适应 hls

[英]Mp4 to dynamic adaptive hls with multiple bitrates using ffmpeg

I tried converting mp4 video to HLS for online streaming which I have successfully done using FFmpeg.我尝试将 mp4 视频转换为 HLS 以进行在线流媒体播放,我已经使用 FFmpeg 成功完成了这项工作。

Command:命令:

ffmpeg -i /var/www/html/file_conversion/heli.mp4 -map 0 -profile:v baseline -level 3.0 -s 640x360 -c:v libx264 -b:v 500k -c:a libfdk_aac -b:a 320k -hls_list_size 0 -start_number 0 -hls_init_time 0 -hls_time 2  -f hls /var/www/html/file_conversion/hlstest2/heli.m3u8

But now I am trying to convert the same video with multiple bitrates for dynamic adaptive streaming.但现在我正在尝试使用多个比特率转换相同的视频以进行动态自适应流传输。

Any idea how can I achieve this?知道我怎么能做到这一点吗?

I was having the same doubt, and found this article: https://dev.to/nodir_dev/transcode-video-source-to-hls-playlist-format-for-video-on-demand-vod-streaming-3h99我也有同样的疑问,发现这篇文章: https : //dev.to/nodir_dev/transcode-video-source-to-hls-playlist-format-for-video-on-demand-vod-streaming-3h99

After making transcoding files, just create a *.m3u8 file, with the following content:制作转码文件后,只需创建一个*.m3u8文件,内容如下:

#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=375000,RESOLUTION=640x360
360_out.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=750000,RESOLUTION=854x480
480_out.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2000000,RESOLUTION=1280x720
720_out.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3500000,RESOLUTION=1920x1080
1080_out.m3u8

now just send this file to the streams.现在只需将此文件发送到流。

My HLS folder:我的 HLS 文件夹:

image_folder图像文件夹

content_of_master_file content_of_master_file

I made the transcoding two resolutions: 1280x720 and 640x480我做了两个分辨率的转码:1280x720 和 640x480

- Author of the article: Nodirbek Sharipov - 文章作者:Nodirbek Sharipov

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM