'ffmpeg - transcoding.c - why the last packet is discard

Using ffmpeg examples transcoding.c. (https://github.com/FFmpeg/FFmpeg/blob/release/4.1/doc/examples/transcoding.c)

This is read by ffprobe.exe (ffprobe.exe -i test.mp4 -show_packets)

[PACKET]
codec_type=video
stream_index=0
pts=162000
pts_time=1.800000
dts=162000
dts_time=1.800000
duration=18000
duration_time=0.200000
size=238317
pos=2285176
flags=__
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=180000
pts_time=2.000000
dts=180000
dts_time=2.000000
duration=18000
duration_time=0.200000
size=24111
pos=2523493
flags=_D

The ​last packet flags has AV_PKT_FLAG_DISCARD.



Solution 1:[1]

An MP4 file might have an edit list and the sample happens to have a composition time outside of the edit list.

So it depends on your video file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 micha137