writing out frames

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

writing out frames

david starkweather
Hello,

I would like to use ffmpeg library to write out a sequence of frames to
a video file.  I should be able to open up a file for writing, and for
each frame, convert it to the proper pixelformat and write it to the
stream.  I realize I could do this manually by just writing the data to
the file in the format of my choice, but I would like to use ffmpeg as
much as possible and avoid having to write it over for different
container formats and pixel formats.  

I can see there is an av_open_input_file() but no corresponding
av_open_output_file().   However,  in the avformat.h header there are
functions for writing the headers and tails of the file, and in the
avcodec.h there are functions for writing frames.  I also notice the
avio.h file but i think this is more for transmitting streams (??).

Can someone give me some pointers as to the approach to take here? So
far, my general strategy has been just the reverse of reading frames
from a file.  Thank you for your time.

dgs.

_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: writing out frames

Luca Abeni
Hi David,

david starkweather wrote:
> I would like to use ffmpeg library to write out a sequence of frames to
> a video file.  I should be able to open up a file for writing, and for
> each frame, convert it to the proper pixelformat and write it to the
> stream.

Look at output_example.c: it shows exactly how to do what you need.


> I can see there is an av_open_input_file() but no corresponding
> av_open_output_file().

You have to use av_alloc_format_context(), open the codecs, and then
use url_fopen() to open the output file (see the first part of
optupt_example.c:main()).


> However,  in the avformat.h header there are
> functions for writing the headers and tails of the file, and in the
> avcodec.h there are functions for writing frames.

It's av_write_frame(), or av_interleaved_write_frame(), in avformat.h.


> I also notice the
> avio.h file but i think this is more for transmitting streams (??).

That's lower level stuff. You probably only need url_fopen() from it.


                                Luca
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user