-
-
Notifications
You must be signed in to change notification settings - Fork 34
Typical Usages
If an mpegts/fmp4 file is in recording
setProperty("continue_at_end", "1")
+ setActiveTracks(MediaType::Audio, {})
player.setActiveTracks(MediaType::Audio, {});
player.setActiveTracks(MediaType::Subtitle, {});
player.setProperty("continue_at_end", "1"); // TODO: remove
player.setBufferRange(0);
create a socket pair, 1 fd is used to write encoded data, another is used for playback
player.setMedia("fd:"); // fd protocol only supports "fd:"
player.setProperty("avio.fd", to_string(fd_read)); // ffmpeg url protocol option
It can be built as a plugin. Requres abi headers. Unlike public api headers, Abi headers depends on c++ abi, so requires the same compiler and c++ library as mdk-sdk is built(clang + libc++ for apple, android and linux, msvc/clang-cl + vcrt for windows, no mingw). Steps:
- Download
mdk-abi-sdk
from artifacts of github actions or sourceforge - Extract to existing mdk-sdk folder. A new dir
mdk-sdk/include/abi
is added. - Change mdk include path to
mdk_sdk_dir/include/abi
and rebuild the project. You can not mix abi headers and public headers in the same source file. This is QIODevice example.
Reduce latency:
player.setProperty("avformat.fflags", "+nobuffer");
player.setProperty("avformat.fpsprobesize", "0");
player.setProperty("avformat.analyzeduration", “100000”);
//player.setProperty("avformat.avioflags", "direct");
For rtsp, use tcp as transport layer protocol to get stable result
player.setProperty("avformat.rtsp_transport", "tcp");
For live streams, we can disable buffering
player.setBufferRange(0); // play ASAP.
drop outdated data and show the latest frames only(e.g. pause a while and resume, play the latest frames)
player.setBufferRange(0, 1000, true); // play ASAP. and keep the latest 1s data
By default packets are dropped if until the 1st key-frame packet to ensure correctly initialize decoder, you can disable dropping via
player.setBufferRange("reader.starts_with_key", "0");
Use FFmpeg decoder if error occurs in other decoders.