Hello,
I am using libffmpeg to open a video file, modify individual image frames as
they are read, and then write them into an output video file along with
unmodified audio packets.
Using ImageMagick Magick++ library I am able to modify the image frames.
With audio disabled, I can recreate a valid output video file.
I have been unable to decode the audio stream because of a codec problem I
am having with AAC, however, I really want to stay away from a solution that
involves decoding audio.
Please help me copy the raw audio packets from the input stream to the
output stream.
Here are some samples of my code:
This loop reads each packet from the input video:
while(av_read_frame(pFormatCtx, &packet) >= 0) { ... }
This condition determines if the package is video:
if(packet.stream_index == videoStream) { ... }
or audio:
else if(audioEnable && packet.stream_index == audioStream) { ... }
As I mentioned, the video processing is working correctly.
Within the audio processing block, please help me determine how to copy the
packet from the input stream to the output stream.
I am assuming that the input data is fully encapsulated by the packet, an
AVPacket object.
The output stream is represented by the output context AVFormatContext *oc
and the output format AVOutputFormat *ofmt.
I do not know how to copy the packet or open the audio stream of the output
context.
Does anyone have a code example that you are willing to share that does what
I am trying to do: copy audio packets as-is from one stream to another. I
do not know what has to be done in terms of opening the correct stream and
writing any header data OR writing the individual packet data.
- Thank you, David
--
View this message in context:
http://n4.nabble.com/How-To-Copy-Raw-Audio-Packets-from-Input-to-Output-Stream-tp998866p998866.html
Sent from the libav-users mailing list archive at Nabble.com.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user