[FFmpeg-user] Write audio frames without decoding/encoding

killkenny64 kennethjjgibson at gmail.com
Tue Feb 14 02:08:27 CET 2012


Andrey Utkin wrote
> 
> Yes. Shortly, you can av_write_frame() the AVPacket you've just got
> from av_read_frame().
> 


I'm trying to write the audio packet into the new file

while(av_read_frame(inputFormatCtx, &packet) >= 0)
    {
        if(packet.stream_index == videoStream)  //videoStream = 0
        {
            //do some stuff and write it
            return;
        }
        if(packet.stream_index == audioStream) //audioStream = 1
        {
            av_interleaved_write_frame(outputFormatCtx, &packet);  //  
<----- crashes here
            av_free_packet(&packet);
            return 0;
        }
    }

But this crashes on the line:
         av_interleaved_write_frame(outputFormatCtx, &packet);

Why is this crashing?
If I ignore audio, I can make a .mp4 with just video and it works perfectly.
Am I doing something obviously wrong here?
For what reasons would av_interleaved_write_frame crash?

Thanks for your help

--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Write-audio-frames-without-decoding-encoding-tp4382904p4385911.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list