diff --git libavformat/mpegtsenc.c libavformat/mpegtsenc.c
index 9efa9fc..cf09bfb 100644
--- libavformat/mpegtsenc.c
+++ libavformat/mpegtsenc.c
@@ -1208,7 +1208,7 @@ int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const AVPack
             av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, "
                    "no startcode found, use the video bitstream filter 'h264_mp4toannexb' to fix it "
                    "('-bsf:v h264_mp4toannexb' option with ffmpeg)\n");
-            return AVERROR_INVALIDDATA;
+            // MEANX : Avidemux does not align the packet well, ignore this error    return AVERROR_INVALIDDATA;
         }
         av_log(s, AV_LOG_WARNING, "H.264 bitstream error, startcode missing, size %d", pkt->size);
         if (pkt->size) av_log(s, AV_LOG_WARNING, " data %08X", AV_RB32(pkt->data));
