How to wrap H264 into a mp4 container?

两盒软妹~` 提交于 2019-12-21 01:18:19

问题


I have a program generating a bunch of raw H264 frames and would like to place that into a mp4 container for streaming.

Anyone know how to do that?

I was thinking I'd use ffmpeg however, this needs to be used commercially and it seems like ffmpeg can only do this through it's x264 library... which uses a GPL license.

Thank you!


回答1:


libmp4v2 is under the MPL and can be used as part of a larger work commercially. It is much lighter than libavformat also.




回答2:


If you're looking for the FFMPEG command line to do that, then try the following:

ffmpeg -i "source.h264" -c:v copy -f mp4 "myOutputFile.mp4"

If you have a separate audio file you can add it too:

ffmpeg -i "source.h264" -i "myAudio" -c:v copy -c:a copy -f mp4 "myOutputFile.mp4"

If your audio needs to be encoded as well (for instance codec AAC-LC, bitrate 256kbps):

ffmpeg -i "source.h264" -i "myAudio" -c:v copy -c:a aac -b:a 256k -strict -2 -f mp4 "myOutputFile.mp4"


来源:https://stackoverflow.com/questions/21263064/how-to-wrap-h264-into-a-mp4-container

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!