[Libav-user] Writing frames into custom buffer

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

[Libav-user] Writing frames into custom buffer

Michael IV
Hi!
 I want to accumulate results of av_interleaved_write_frame() in a buffer instead of a file.


avformat_alloc_output_context2() file name parameter can be null. That probably means I should be
able to access some internal buffer with the write frames?Or can I supply a custom buffer to write the frames to? 
Tnx!

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Writing frames into custom buffer

Anton Shekhovtsov


2017-09-27 14:35 GMT+03:00 Michael IV <[hidden email]>:
Hi!
 I want to accumulate results of av_interleaved_write_frame() in a buffer instead of a file.


avformat_alloc_output_context2() file name parameter can be null. That probably means I should be
able to access some internal buffer with the write frames?Or can I supply a custom buffer to write the frames to? 
Tnx!

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


Something like this

  Buffer io;
  int buf_size = 4096;
  void* buf = av_malloc(buf_size);
  AVIOContext* avio_ctx = avio_alloc_context((unsigned char*)buf,buf_size,1,&io,0,&Buffer::Write,&Buffer::Seek);
  AVFormatContext* ofmt = avformat_alloc_context();
  ofmt->pb = avio_ctx;


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user