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?