-
Notifications
You must be signed in to change notification settings - Fork 37
[VideoToolbox] Force SW decoder for interlaced h264 videos on iOS/tvOS devices #15
base: release/4.3-kodi
Are you sure you want to change the base?
Conversation
…t start with an I-Frame
fixes the version string when building from the kodi depends src tree
…x of a surface which points to nirvana. it may occurs when a stream starts with non i-frame.
This fixes / workarounds https://bugs.freedesktop.org/show_bug.cgi?id=105368. It was hit frequently when watching h264 channels received via DVB-X. Corresponding kodi bug: xbmc/xbmc#15704
@tmm1 can you comment on the state of the patch as I looks like it was never applied upstream? |
@lrusak, You can subscribe on #tvos-freenode, tmm1 answered for your question on it ;-) |
@sy6sy2 are you willing to take this patch on and try to get it merged upstream? Otherwise we will start taking on extra debt here which isn't nice in the long run. |
Not sure to correctly understand your message, but on my side I am just waiting your review and/or your merge ;-) |
It's the stance that patches should be upstreamed. So what lrusak is saying is can you run with it with ffmpeg and try and get the fix/change merged there. @phunkyfish might be able to give some insight/guidance into that process, and tmm1 is available in slack |
As I noted in my original patch, my heuristic here is not comprehensive and will return an error on some videos which actually can be decoded by VT on iOS.
So to merge this upstream, we need either:
I am happy to review patches for either approach and merge upstream. https://s3.amazonaws.com/tmm1/videotoolbox/interlaced.ts
|
Thank you Fuzzard for explained me (still some issue with English...). I have no problem to open a PR in ffmpeg repo but I'm not sure to be the right person to do that ; I have absolutely no background on video stuff :-/. Maybe if we open a PR someone from ffmpeg will help us to have a more accurate check? |
mediainfo says interlaced.ts is "Interleaved fields", whereas the other two are "Separated fields". If we can find where in the PPS/SPS that information comes from that would help improve the heuristic. |
This is exactly what my first patch was like 😉 |
Maybe can we ask to FFMPEG guys? |
Technically @tmm1 is an ffmpeg guy 😉 Similar to kodi there are parts of ffmpeg without maintainers. Generally the best way to get something fixed is to do some deep learning. |
I will try to understand something about that, but I do not promise anything 😜 |
|
So, based on tmm1's samples, we have (ATM):
This is what I have:
I have absolutely no idea what these flags are supposed to describe but with a combination of both Edit: Also found that (source: http://forum.doom9.org/archive/index.php/t-96598.html):
|
I tried this code: case kCMVideoCodecType_H264 : {
const H264Context *h = avctx->priv_data;
const H264SliceContext *sl = h->slice_ctx;
const int field_pic_flag = get_bits1(&sl->gb);
if (TARGET_OS_IPHONE && h->ps.sps->frame_mbs_only_flag == 0 && field_pic_flag == 1) {
av_log(avctx, AV_LOG_ERROR, "VideoToolbox cannot decode interlaced fields on iOS\n");
CFRelease(avc_info);
goto fail;
} But for the three interlaced.ts files this |
I also found that there is a const H264Context *h = avctx->priv_data;
const H264Picture *pic = h->cur_pic_ptr; I have a nullptr on I have absolutely no idea how to do now :-( |
922f5ee
to
5a1e9dc
Compare
FYI: This is how VLC handle the issue: https://code.videolan.org/videolan/vlc/-/commit/547ce8c47e1abadb18d6999332762e3266ebf245 |
So, some months later iOS and tvOS Kodi users that use Live TV feature with channels using H264 interlaced stream (like in France) are still with the following issue :
As we saw, it's look like hard to fix the problem upstream, so this is some solutions I thought and I would like your opinion about that:
Thank you for your help! |
This is still open. I have reported this issue 1 year ago... And I'm really tired to manually switch every time between LiveTV and 4k movies... If it's hard to fix deeply Solution1 or Solution2 will be very good options for now. |
This would not be our oldest bug by far. Please bear in mind that the way to fix this is to get it repaired upstream. Getting things into ffmpeg can be a very involved process. |
On iOS and tvOS devices VideoToolbox is not able to correctly decode some interlaced h264 videos.
But on macOS everything works fine.
This patch, found here https://patchwork.ffmpeg.org/project/ffmpeg/patch/[email protected]/#16694 (thank you @tmm1), force FFMPEG to use SW decoding in the special case "iOS/tvOS + interlaced h264 video".
This path will fix the issue given here xbmc/xbmc#18287