[Libav-user] Please help me about transcoding to TS stream: H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)
kalileo at universalx.net
Fri Mar 9 17:27:40 CET 2012
On Mar 9, 2012, at 22:20 , Li Zhang wrote:
> Hi everyone,
> I am a new user to ffmpeg API. I want to transcode mpeg2 video stream to H.264+AAC and then put them into TS container again.
> I have implemented transcoding from mpeg2 TS to AVI, MKV, MP4 local files. Now the problem is when I used the same code put those H.264+AAC data packet into TS container, the video can not be played and only the audio can be played. Actually, there was video packet data in the .ts file which was derived from trandcoding.
> And I got the information from ffmpeg that "H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)". So I initiated the h264_mp4toannexb bitstreamfilter and use av_bitstream_filter_filter to process the packet before write them to output file. However, av_bitstream_filter_filter returns 0 and the final output file still the same situation and the warning information still happen.
> There is another warning information about DTS, it only happen every 29 frames. That is so strange. Please help me. I used the latest version of ffmpeg.
> When I used the Elecard Stream Analyzer to check my transcoded file, I found the file missed SPS and SEI information for the video stream. There is only SPS and SEI information for audio stream. I do not know why the TS container can not produce these information for me.
IMHO h264_mp4toannexb does not work if you convert from mpegts stream to mpegts stream, because as far as I have understood it h264_mp4toannexb expects mp4 as source and not mpegts. you need to do manually what h264_mp4toannexb would do, that is adding the h264 Annex B header in front of every h264 frame.
I'm sure the experts here can confirm or correct me, and explain better what to do.
More information about the Libav-user