[Libav-user] Simple demux and copy codec
atlithorn at gmail.com
Sat Nov 24 00:54:27 CET 2012
I'll just keep answering myself, it was all because of bad init code.
Thanks for being the teddy bear ;)
On 23 November 2012 22:09, Atli Thorbjornsson <atlithorn at gmail.com> wrote:
> I was right, I was missing options so I add the following to the init phase
> opts = setup_find_stream_info_opts(iformatCtx, codec_opts);
> err = avformat_find_stream_info(iformatCtx,opts);
> instead of just
> err = avformat_find_stream_info(iformatCtx,NULL)
> And then
> That fixed my AAC output, it's now identical to ffmpeg's but it broke
> MP3... I get the following error
> [mp3 @ 0x7f9c73060c00] Invalid audio stream. Exactly one MP3 audio stream
> is required.
> failed to write header: Invalid argument
> Almost there ;)
> On 23 November 2012 18:21, Atli Thorbjornsson <atlithorn at gmail.com> wrote:
>> 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...
More information about the Libav-user