[FFmpeg-devel] [PATCH]Accept startcode 001 when remuxing H264 into mpegts

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Feb 25 00:05:27 CET 2015


On Tuesday 09 April 2013 03:21:33 pm Carl Eugen Hoyos wrote:
> Hi!
>
> Attached patch fixes remuxing of h264 into mpeg-ts for some wtv input
> files.

Updated patch attached, WMP and QT play such samples.
Fixes ticket #4324.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index a56ca0e..926f041 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1202,7 +1202,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
 
 int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const AVPacket *pkt)
 {
-    if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
+    if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001 && AV_RB24(pkt->data) != 0x000001) {
         if (!st->nb_frames) {
             av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, "
                    "no startcode found, use the video bitstream filter 'h264_mp4toannexb' to fix it "


More information about the ffmpeg-devel mailing list