From: Jun Zhao <barryjz...@tencent.com>

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 <barryjz...@tencent.com>
---
 doc/examples/encode_video.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
index 6731b2a..d9ab409 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);
-- 
1.7.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to