Reputation: 633
I'm working on a project that needs to open .mp4
file format, read its frames 1 by 1, decode them and encode them with better type of lossless compression, and save them into a file.
From my understanding, it should go like this:
So far, I encountered a couple of problems. For example, if I want to save a frame using av_interleaved_write_frame()
function. I can't open input a .mp4
file using avformat_open_input()
since it's going to populate filename
part of the AVFormatContext
structure with the input file name, and therefore, I can't "write" into that file.
I've tried a different solution using av_guess_format()
, but when I dump format using dump_format()
, I get nothing, So I can't find stream information about which codec it is using.
How should this be done?
Upvotes: 4
Views: 15496
Reputation: 11184
See the "detailed description" in the muxing docs. You:
Upvotes: 6
Reputation: 11545
You can convert a video to a sequence of losses images with:
ffmpeg -i video.mp4 image-%05d.png
and then from a series of images back to a video with:
ffmpeg -i image-%05d.png video.mp4
The functionality is also available via wrappers.
You can see a similar question at: Extracting frames from MP4/FLV?
Upvotes: -3