Apple App Store批准所需的FFMpeg HLS输出设置

时间:2016-04-29 00:26:02

标签: ffmpeg appstore-approval hls m3u8

我看了很多,但到目前为止我还没有找到我的问题的直接答案。

所需的最低FFMpeg命令行输出和分段设置是什么,它将生成Apple App Store批准应用程序中播放的视频文件所需的所有必需HLS .m3u8和.ts文件组合的最小集合?

请注意,此处有较旧的Q& As,这是在FFMpeg为HLS添加原生细分之前编写的。因此,我正在寻找100%FFMpeg解决方案来输出Apple正在寻找的东西。我不关心这个答案的输入格式,因为FFMpeg读取了我们想要使用的大多数文件。

请注意,正确答案应考虑Apple寻找的总流量等的最大带宽要求设置。

我打赌那里有人已经得到了这个答案,甚至可能在一些代码中运行,但我希望看到它发布以节省我们其余的时间。

谢谢!

1 个答案:

答案 0 :(得分:1)

最小值是一个视频流和一个64k纯音频流,带有h.264和aac。也就是说,这就是我使用的,180p + 360p + 480p + 720p + 1080p + 64aac,只需将您需要的部件组合在一起。

我收到各种尺寸的视频,因此我的代码将所有内容打包或剪辑到16:9,如果您不需要,请将其删除。

此外,您需要生成指向其他主m3u8的主m3u。

[无论如何] - > h.264 + AAC

ffmpeg -y -async 1 -vsync -1 -analyzeduration 999999999 -i INPUT.FILE
#180p -movflags faststart -keyint_min 30 -x264opts "keyint=30:min-keyint=30:no-scenecut" -g 30 -filter:v "scale=iw*min(320/iw\,180/ih):ih*min(320/iw\,180/ih), pad=320:180:(320-iw*min(320/iw\,180/ih))/2:(180-ih*min(320/iw\,180/ih))/2" -r:v 30 -s 320x180 -b:v 320k -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -c:a libfdk_aac -ac 2 -ar 48000 -b:a 64k OUTPUT-180.MP4
#360p -movflags faststart -keyint_min 30 -x264opts "keyint=30:min-keyint=30:no-scenecut" -g 30 -filter:v "scale=iw*min(640/iw\,360/ih):ih*min(640/iw\,360/ih), pad=640:360:(640-iw*min(640/iw\,360/ih))/2:(360-ih*min(640/iw\,360/ih))/2" -r:v 30 -s 640x360 -b:v 640k -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -c:a libfdk_aac -ac 2 -ar 48000 -b:a 96k OUTPUT-360.MP4
#480p -movflags faststart -keyint_min 30 -x264opts "keyint=30:min-keyint=30:no-scenecut" -g 30 -filter:v "scale=iw*min(854/iw\,480/ih):ih*min(854/iw\,480/ih), pad=854:480:(854-iw*min(854/iw\,480/ih))/2:(480-ih*min(854/iw\,854/ih))/2" -r:v 30 -s 854x480 -b:v 680k -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -c:a libfdk_aac -ac 2 -ar 48000 -b:a 96k OUTPUT-480.MP4
#720p -movflags faststart -keyint_min 30 -x264opts "keyint=30:min-keyint=30:no-scenecut" -g 30 -filter:v "scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih), pad=1280:720:(1280-iw*min(1280/iw\,720/ih))/2:(720-ih*min(1280/iw\,720/ih))/2" -r:v 30 -s 1280x720 -b:v 1280k -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.1 -c:a libfdk_aac -ac 2 -ar 48000 -b:a 128k OUTPUT-720.MP4
#1080p -movflags faststart -keyint_min 30 -x264opts "keyint=30:min-keyint=30:no-scenecut" -g 30 -filter:v "scale=iw*min(1920/iw\,1080/ih):ih*min(1920/iw\,1080/ih), pad=1920:1080:(1920-iw*min(1920/iw\,1080/ih))/2:(1080-ih*min(1920/iw\,1080/ih))/2" -r:v 30 -s 1920x1080 -b:v 1640k -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 4.0 -c:a libfdk_aac -ac 2 -ar 48000 -b:a 128k OUTPUT-1080.MP4
#aac -c:a libfdk_aac -ac 2 -ar 48000 -b:a 64k OUTPUT-AAC.AAC

MP4 - > TS

#180p ffmpeg -y -async 1 -vsync -1 -analyzeduration 999999999 -i OUTPUT-180.MP4 -codec copy -map 0 -f segment -segment_list OUTPUT-180.M3U8 -segment_time 10 -segment_list_type m3u8 -bsf:v h264_mp4toannexb SEGMENT-180%05d.TS
#360p ffmpeg -y -async 1 -vsync -1 -analyzeduration 999999999 -i OUTPUT-360.MP4 -codec copy -map 0 -f segment -segment_list OUTPUT-360.M3U8 -segment_time 10 -segment_list_type m3u8 -bsf:v h264_mp4toannexb SEGMENT-360%05d.TS
#480p ffmpeg -y -async 1 -vsync -1 -analyzeduration 999999999 -i OUTPUT-480.MP4 -codec copy -map 0 -f segment -segment_list OUTPUT-480.M3U8 -segment_time 10 -segment_list_type m3u8 -bsf:v h264_mp4toannexb SEGMENT-480%05d.TS
#720p ffmpeg -y -async 1 -vsync -1 -analyzeduration 999999999 -i OUTPUT-720.MP4 -codec copy -map 0 -f segment -segment_list OUTPUT-720.M3U8 -segment_time 10 -segment_list_type m3u8 -bsf:v h264_mp4toannexb SEGMENT-720%05d.TS
#1080p ffmpeg -y -async 1 -vsync -1 -analyzeduration 999999999 -i OUTPUT-1080.MP4 -codec copy -map 0 -f segment -segment_list OUTPUT-1080.M3U8 -segment_time 10 -segment_list_type m3u8 -bsf:v h264_mp4toannexb SEGMENT-1080%05d.TS
#aac ffmpeg -y -async 1 -vsync -1 -analyzeduration 999999999 -i OUTPUT-AAC.AAC -codec copy -map 0 -f segment -segment_list OUTPUT-AAC.M3U8 -segment_time 10 -segment_list_type m3u8 -bsf:v h264_mp4toannexb SEGMENT-AAC%05d.TS