MP4V2 使用——编译、录制

来源:互联网 发布:sql注入是什么 编辑:程序博客网 时间:2024/05/19 16:51

MP4V2——编译、使用

 

MP4格式的录制可以用ffmpeg,可以参考我的文章http://blog.csdn.net/qq_23282479/article/details/75041518 ,也可以用MP4V2,这个个专门录制MP4格式视频的库,如果你只想使用录制MP4这个功能,或者不想用ffmpeg那么大的库的话,就用MP4V2吧。

 

一、MP4V2 的编译

 

参考 http://blog.csdn.net/yuan1125/article/details/51051683 

 

./configure --prefix=/home/linux/mp4v2-2.0.0/_install --host=arm-xxx-linux CC=arm-xxx-linux-gcc CXX=arm-xxx-linux-g++ --disable-optimize --enable-util

make

make install

如果没出现动态库,就是--host 没设置好,或者是export PATH 没设置好。

 

二、MP4v2的使用

 

代码参考:

http://blog.csdn.net/jwzhangjie/article/details/8782650 //讲解函数

http://www.cnblogs.com/chutianyao/archive/2012/04/13/2446140.html //一个例子

 

 

make出现错误

streaming.h:72: error: expected declaration specifiers or '...' before 'MP4TrackId'

error: expected '=', ',', ';', 'asm' or '__attribute__' before 'MP4GetHintTrackReferenceTrackId'

 

原因是可能包含了cpp 的头文件。

百度:其中mp4v2.h是顶层include文件。使用mp4v2库时,只需包含mp4v2.h即可。

 

make出现错误:libmp4v2.so: undefined reference to `std::basic_string<char, st

加入mp4v2库依赖的库libstdc++.solibm.soMakefile里   

-lstdc++ -lm

make成功

 

 

写视频文件的时候如果把sps pps 等除了I P B帧之外的东西,只用在开头只写一次,就没问题。如果每次都写进去,就有可能会造成音视频不同步。

 

 

有时用mp4trackdump 不能查看录制下来的MP4文件,若要查看,设置MP4_Close第二个参数要设置0

 

原创粉丝点击