aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorJun Zhao <barryjzhao@tencent.com>2019-08-05 12:53:55 +0800
committerJun Zhao <barryjzhao@tencent.com>2019-08-08 17:58:50 +0800
commite512d893bfcf6eb0fb60a7601ba1b02d8b44452a (patch)
tree22e93892e359cf7e5630733a9727583ec14fe950 /doc
parente282b7ed7bf8d70135c03ec5555c994f2707009e (diff)
downloadffmpeg-e512d893bfcf6eb0fb60a7601ba1b02d8b44452a.tar.gz
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@tencent.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/encode_video.c3
1 files changed, 2 insertions, 1 deletions
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);