[Libav-user] newb mp4 question

Atli Thorbjornsson atlithorn at gmail.com
Thu Oct 6 00:18:24 CEST 2011


Hi, I'm trying to remux an flv muxed aac stream using the mp4 muxer.
(movenc.c). It works fine so long as I call av_write_trailer.

Problem is I also need to remux live (long running) streams, how would
I go about that. Currently a skeleton of my code looks like this

init_input
init_output

do{
  av_init_packet(&ipacket)
  av_read_frame(iFormatCtx, &ipacket);
  if(packet.stream_index == audioStrem){
    av_init_packet(&opacket);

    copy stuff around, code borrowed from ffmpeg.c

    av_write_frame(oFormatCtx, &opacket);
    av_free_packet(&opacket);
  }
  av_free_packet(&ipacket);

}while(stuff is incoming);

av_write_trailer(oFormatCtx);


I was hoping I could buffer av_write_frame calls and write out to a
client but the client can't understand the file without the trailer it
seems. I'm new to this stuff so I was hoping someone could point me in
the right direction.

Before you ask, I am streaming to the Android MediaPlayer so my format
options are a little limited.

Thanks,
Atli.


More information about the Libav-user mailing list