[英]Not able to decode mp4 file using latest ffmpeg library : av_decode_video2
[英]FFmpeg decoding .mp4 video file
我正在一个项目中,该项目需要打开.mp4文件格式,将其帧一一读取,对其进行解码,并使用更好的无损压缩类型对其进行编码,然后将其保存到文件中。
如果我在做事顺序上有误,请指正我,因为我不是100%地确定该怎么做。 据我了解,它应该像这样:
1. Open input .mp4 file
2. Find stream info -> find video stream index
3. Copy codec pointer of found video stream index into AVCodecContext type pointer
4. Find decoder -> allocate codec context -> open codec
5. Read frame by frame -> decode the frame -> encode the frame -> save it into a file
到目前为止,我遇到了几个问题。 例如,如果我想用保存框架av_interleaved_write_frame()
函数,我不能使用开放输入.mp4档案avformat_open_input()
因为它的会填充filename
中的一部分AVFormatContext
结构,输入文件名,所以不能“写入”到该文件中。 我曾尝试使用av_guess_format()
尝试不同的解决方案,但是当我使用dump_format()
转储格式时,我什么也没得到,所以我找不到有关它正在使用哪种编解码器的流信息。
因此,如果有人有任何建议,我将非常感谢。 先感谢您。
请参阅muxing docs中的“详细说明”。 您:
您可以使用以下方法将视频转换为一系列损失图像:
ffmpeg -i video.mp4 image-%05d.png
然后从一系列图像返回到具有以下内容的视频:
ffmpeg -i image-%05d.png video.mp4
该功能也可以通过包装器使用。
您可以在以下位置看到类似的问题: 从MP4 / FLV中提取帧吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.