[Libav-user] Remuxing mpegts udp stream, how to fill AVCodecContext.extradata of outgoing stream?
Kalileo
kalileo at universalx.net
Sun Feb 5 14:47:58 CET 2012
I have a mpegts file (h264/aac) which was created by dumping a mpegts udp stream to a file. (the file can be played with vlc etc. perfectly).
Now I need to convert that file again to a stream (without decoding/encoding). If I simply parse the file and remux the frames to an mpegts udp stream the resulting stream is not really playable, vlc can play just fragments of video and audio and a lot of errors. (remuxing to a file in any format works though).
Apparently the headers in the outgoing h264 and in the outgoing aac are missing, and to add them I need to fill the extradata of their CodecContext . Because I do not have an incoming stream anymore, but read a file, I cannot copy the extradata from the incoming stream's codec context (it is empty), but apparently I need to manually fill the extradata of the Context of the outgoing stream.
Despite going through the mailing list archives up and down and scanning the source code of ffmpeg and libavcodec /libavformat (and googling for days) I still do not see how I can copy the header info from the (incoming) x264 and aac codecs into the extradata of the outgoing Codec Context.
Any sample code (or pointer to source code) where I can see where to get the required info (priv_data?) and how to format and write it into extradata is very much appreciated!
More information about the Libav-user
mailing list