Reputation: 81
I'm writing an AV muxer DirectShow Filter on Windows platform using ffmpeg, it muxes video & audio streams into mp4/ts/flv file, or rtsp/rtmp/udp stream, I confirm that the dts of video/audio stream is increased orderly so dts reorder is no needed, so can I use av_write_frame()
instead of av_interleaved_write_frame()
? av_write_frame()
writes packet to muxer directly, av_interleaved_write_frame()
will make a copy of packet if it is not reference-counted, so I prefer to use av_write_frame()
because I think it should be more efficient (no copying or buffering), is my thinking correct? Can I use av_write_frame()
?
Upvotes: 2
Views: 4731
Reputation: 11174
Yes. As the documentation for av_write_frame()
states:
This function passes the packet directly to the muxer, without any buffering or reordering. The caller is responsible for correctly interleaving the packets if the format requires it. Callers that want libavformat to handle the interleaving should call av_interleaved_write_frame() instead of this function.
Upvotes: 6