[Libav-user] Simple demux and copy codec

Atli Thorbjornsson atlithorn at gmail.com
Fri Nov 23 19:21:32 CET 2012

I am trying to use ffmpeg in Android as a demuxer for FLV contained audio.

As a proof of concept I wrote a barebones demuxer->muxer in C that
essentially tries to mimic this ffmpeg command

ffmpeg -i input.flv -acodec copy output.aac

The output of ffmpeg obviously works perfectly. But my program's output
differs by a few bytes, I think it's the ADTS header or something.
My program can also do FLV contained MP3 and even though my program's
output still differs by a few bytes, my output is playable.

Only too happy to share the entire source if someone has the time to wade
through it but the basic functionality is like so:

init a whole lot of stuff
while(av_read_frame(inputFormatCtx, &inputPacket))
   if(inputPacket.stream_index == audioStreamIndex)
       av_interleaved_write_frame(outputFormatCtx, inputPacket)

I've been wading through ffmpeg.c to try and figure out what I'm missing
but no luck as of yet.
I'm guessing I should add some options to avformat_write_header instead of
NULL but I haven't been able to figure out what.

Many thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121123/798ce367/attachment.html>

More information about the Libav-user mailing list