jjzjj

C++ FFmpeg 创建 mp4 文件

我正在尝试使用FFmpeg和C++创建mp4视频文件,但结果我收到损坏的文件(Windows播放器显示“无法播放...0xc00d36c4”)。如果我创建.h264文件,它可以用'ffplay'播放并通过CL成功转换为mp4。我的代码:intmain(){char*filename="tmp.mp4";AVOutputFormat*fmt;AVFormatContext*fctx;AVCodecContext*cctx;AVStream*st;av_register_all();avcodec_register_all();//autodetecttheoutputformatfrom