Closed pierrexn closed 1 year ago
这个文件估计有问题,用vlc或者ffplay播放都是没有任何画面,只有声音。
Because no video track in this file. Thumbnail example works as expected
i use the code that you have sent me
p.prepare(from, [&](int64_t pos, bool*) {
if ((pos < 0 || p.mediaInfo().video.empty() && test_flag(p.mediaStatus(), mdk::MediaStatus::Loaded)))
pm.set_value(-2);
else
{
auto ret = p.seek((p.mediaInfo().duration * video_frame_percent) / 100
, mdk::SeekFlag::FromStart | mdk::SeekFlag::KeyFrame | mdk::SeekFlag::Backward // KeyFrame: thumbnail should be fast. backward: avoid EPERM error
, [&](int64_t pos) {
if (pos < 0 && test_flag(p.mediaStatus(), mdk::MediaStatus::Loaded)) { // check loaded: unfinished seek callback
pm.set_value(-3);
}
});
if (ret == 0)
pm.set_value(-1);
}
return true;
});
As i see in Thumbnail example, you have no more test_flag(p.mediaStatus(), mdk::MediaStatus::Loaded)
the example is updated: https://github.com/wang-bin/mdk-examples/blob/master/Native/Thumbnail.cpp
Thanks with updated code, it seems to work...
Try to extract thumbnail on this .mp4 (Windows x64)
In the callback for p.prepare, p.seek return true but callbakc for p.onFrame is never called
https://github.com/wang-bin/mdk-sdk/assets/1200371/5fee6721-f7d6-40b6-83b2-6be7a14828fb