[FFmpeg-devel] [RFC] mpeg4 parser do not split of sequence end code

Reimar Döffinger Reimar.Doeffinger
Tue Jun 22 21:25:30 CEST 2010

currently the parser ends up putting a sequence end marker at the very end
of a file into a separate packet.
As a result, the decoder then complains about not being able to find proper
frame headers.
The solutions I saw:
1) Do not care about that
2) Make the decoder ignore packets that contain only a sequence end code
3) Make the parser keep the sequence end code together with the previous
   frame if any.

This patch should implement 3):
Index: libavcodec/mpeg4video_parser.c
--- libavcodec/mpeg4video_parser.c      (revision 23711)
+++ libavcodec/mpeg4video_parser.c      (working copy)
@@ -51,7 +51,7 @@
             return 0;
         for(; i<buf_size; i++){
             state= (state<<8) | buf[i];
-            if((state&0xFFFFFF00) == 0x100){
+            if((state&0xFFFFFF00) == 0x100 && state != 0x1B1){
                 return i-3;

More information about the ffmpeg-devel mailing list