[FFmpeg-cvslog] examples/encode_video: only add sequence end code for mpeg1/2 video

Jun Zhao git at videolan.org
Thu Aug 8 13:20:33 EEST 2019


ffmpeg | branch: master | Jun Zhao <barryjzhao at tencent.com> | Mon Aug  5 12:53:55 2019 +0800| [e512d893bfcf6eb0fb60a7601ba1b02d8b44452a] | committer: Jun Zhao

examples/encode_video: only add sequence end code for mpeg1/2 video

Only add sequence end code for mpeg1/mpeg2 video, or else use the encoder
libx264 or libx265 in this sample, decoding the output file will get
unknow NALU type error.

Signed-off-by: Jun Zhao <barryjzhao at tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e512d893bfcf6eb0fb60a7601ba1b02d8b44452a
---

 doc/examples/encode_video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
index 6731b2ad19..d9ab409908 100644
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@ -186,7 +186,8 @@ int main(int argc, char **argv)
     encode(c, NULL, pkt, f);
 
     /* add sequence end code to have a real MPEG file */
-    fwrite(endcode, 1, sizeof(endcode), f);
+    if (codec->id == AV_CODEC_ID_MPEG1VIDEO || codec->id == AV_CODEC_ID_MPEG2VIDEO)
+        fwrite(endcode, 1, sizeof(endcode), f);
     fclose(f);
 
     avcodec_free_context(&c);



More information about the ffmpeg-cvslog mailing list