I'm trying to demux an RTSP stream and remux it into a TS file, using libavformat, libavcodec,etc., copying the video and transcoding the audio. If I use ffmpeg, the command is roughly like this:

ffmpeg -rtsp_transport tcp -re -fflags +genpts -i rtsp://10.0.0.42/channel1 -vcodec copy -copyts -bsf dump_extra -acodec libfdk_aac -b:a 16k -ac 1 -map 0:0 -map 0:1 -f mpegts out.ts

I've looked at the muxing/demuxing examples, but aside from having difficulty understanding how to make a stream copy, I can't find any mention of bitstream filters. I'm currently getting the following error:

[mpegts @ 0x7ff20c009600] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)

How do I create a bitstream filter and how do I assign it? Do I assign it to the input stream, or the output stream?

有帮助吗?

解决方案

The bitstream filters are sadly underdocumented, but shouldn't be all that hard to figure out. The simplest way is probably just emulating what avconv does -- setup, then apply the filter to each packet right before muxing it.

其他提示

You could find the MPEG-2 TS short description here http://wiki.multimedia.cx/index.php?title=MPEG-2_Transport_Stream The example TS files (for h.264): http://samples.mplayerhq.hu/V-codecs/h264/

But your question is not clear. What you want to do exactly? Do you want create your own muxer for TS?

BR, Alexander

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top