Running into a problem when using AVPacket.duration value of 0, and writing to MP4/MOV with av_write_frame(). Overall, the approach works. However there's a problem with the last packet written to the file, which ends up with AV_PKT_FLAG_DISCARD added by the muxer. This doesn't seem to happen when writing to other formats (verified .mkv/.ts work as expected), so it seems like MOV mux having some trouble with figuring out last packet's duration, and prefers to just chuck it.

The only two workarounds I've found is

1. write an actual discardable/empty packet at the end of the file (adding AV_PKT_FLAG_DISCARD and proper pts to it).
2. buffer at least one packet, and flush it on close

The first solution seems dirty (and we did run into some consumers that have problems with input having D-flagged packets), the second solution would require more code restructuring than desirable. Is there no other way to indicate last packet's duration to MOV mux when writing the trailer/closing the file?

_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to