Opened 8 years ago

Closed 8 years ago

#5678 closed defect (fixed)

DVD Subtitles broken in 3.1

Reported by: FernetMenta Owned by:
Priority: important Component: avformat
Version: git-master Keywords: dvdsub codecpar regression
Cc: fritsch@kodi.tv, Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

We were trying to upgrade ffmpeg to 3.1 for new release of Kodi but DVD menus stopped working. Subtitle streams (at least those for menus) are not recognised as valid subtitle streams anymore. Instead AvFormatContext has invalid streams. As a result menu selectors are not visible.

Version 3.0 does work.

Should be reproducible with most DVDs. If you need a downsized sample, let me know.

Change History (22)

comment:1 by fritsch, 8 years ago

Cc: fritsch@kodi.tv added

comment:2 by Carl Eugen Hoyos, 8 years ago

Keywords: dvdsub regression added; DVD removed
Priority: normalimportant

Assuming this issue is reproducible with current FFmpeg git head, please run git bisect to find out which change introduced the issue.
Please also double-check if my regression test for ticket #5676 is correct.

comment:3 by FernetMenta, 8 years ago

I only have my Mac atm and Kodi's depends build system does not allow bisecting. @fritsch could you please do so. Shooting from the hip I'd guess: https://github.com/FFmpeg/FFmpeg/commit/6f69f7a8bf6a0d013985578df2ef42ee6b1c7994

comment:4 by fritsch, 8 years ago

Will do. I am just verifying https://trac.ffmpeg.org/ticket/5676 and using shared ffmpeg libs for doing so, so can happily bisect ffmpeg after that.

Edit: Building against shared libs is nothing we support (out of exactly these reasons) - will bisect now for this bugreport.

Last edited 8 years ago by fritsch (previous) (diff)

comment:5 by Carl Eugen Hoyos, 8 years ago

Did you already test 6f69f7a8 and 60b75186?

comment:6 by fritsch, 8 years ago

I have 6 steps to go - will report back when finished. Current log:

git bisect start
# good: [0c9490609d888ba384798777a3daaf012488ad89] avformat: support shorten in nistshpere demuxer
git bisect good 0c9490609d888ba384798777a3daaf012488ad89
# bad: [8a3221cc67a516dfc1700bdae3566ec52c7ee823] avformat/mov: Check sample size
git bisect bad 8a3221cc67a516dfc1700bdae3566ec52c7ee823
# bad: [7155bd1c94c285ac53e675c7f66acc28d7fa2a71] avcodec/m101: Ask for samples with too small extradata_size
git bisect bad 7155bd1c94c285ac53e675c7f66acc28d7fa2a71
# bad: [ee38234c43b6b3280304be7a43dc569cef683c43] Merge commit 'e481458bc308ee838deaeacac51929514762e7a7'
git bisect bad ee38234c43b6b3280304be7a43dc569cef683c43
# bad: [0520d573db71171053a684b1b2fed0598df1641f] Merge commit '9765549f551ff40869aee1a6492b6a976c86cfe9'
git bisect bad 0520d573db71171053a684b1b2fed0598df1641f
# bad: [197fa698c6cf77b31f3e29a2f685aa52e7404b8b] Merge commit '97aec6e75ef36ed0402653519daa8e1fc8ddb555'
git bisect bad 197fa698c6cf77b31f3e29a2f685aa52e7404b8b

comment:7 by Carl Eugen Hoyos, 8 years ago

You could try to avoid the tedious bisect...

comment:8 by fritsch, 8 years ago

I had to skip some libav commits as they broke configure and build system (in the middle of a merge commit), here is the bisecting result:

There are only 'skip'ped commits left to test.
The first bad commit could be any of:
9200514ad8717c63f82101dc394f4378854325bf
6f69f7a8bf6a0d013985578df2ef42ee6b1c7994
We cannot bisect more!

My history:
git bisect start
# good: [0c9490609d888ba384798777a3daaf012488ad89] avformat: support shorten in nistshpere demuxer
git bisect good 0c9490609d888ba384798777a3daaf012488ad89
# bad: [8a3221cc67a516dfc1700bdae3566ec52c7ee823] avformat/mov: Check sample size
git bisect bad 8a3221cc67a516dfc1700bdae3566ec52c7ee823
# bad: [7155bd1c94c285ac53e675c7f66acc28d7fa2a71] avcodec/m101: Ask for samples with too small extradata_size
git bisect bad 7155bd1c94c285ac53e675c7f66acc28d7fa2a71
# bad: [ee38234c43b6b3280304be7a43dc569cef683c43] Merge commit 'e481458bc308ee838deaeacac51929514762e7a7'
git bisect bad ee38234c43b6b3280304be7a43dc569cef683c43
# bad: [0520d573db71171053a684b1b2fed0598df1641f] Merge commit '9765549f551ff40869aee1a6492b6a976c86cfe9'
git bisect bad 0520d573db71171053a684b1b2fed0598df1641f
# bad: [197fa698c6cf77b31f3e29a2f685aa52e7404b8b] Merge commit '97aec6e75ef36ed0402653519daa8e1fc8ddb555'
git bisect bad 197fa698c6cf77b31f3e29a2f685aa52e7404b8b
# bad: [8cae006c5646a08fd73cf62c46bb16598be6c7b4] Merge commit '1138eb5509d3db7f6d565cb45f137a786d22beb9'
git bisect bad 8cae006c5646a08fd73cf62c46bb16598be6c7b4
# good: [60b75186b2c878b6257b43c8fcc0b1356ada218e] avcodec/wmalosslessdec: do not discard last frame
git bisect good 60b75186b2c878b6257b43c8fcc0b1356ada218e
# bad: [02d08da81fd8ad4bb41c79a57815abc067f0ee2b] avdevice/caca: switch to codecpar
git bisect bad 02d08da81fd8ad4bb41c79a57815abc067f0ee2b
# bad: [bbf5ef9dac9475d8ed22da23acc2eb63a2640784] Merge commit '15e84ed3f141c586e8cb78ed58365cf5a511108a'
git bisect bad bbf5ef9dac9475d8ed22da23acc2eb63a2640784
# skip: [15e84ed3f141c586e8cb78ed58365cf5a511108a] avconv: convert to codecpar
git bisect skip 15e84ed3f141c586e8cb78ed58365cf5a511108a
# bad: [6372c9dc9972318e75a5889ad6c52500b8294099] Merge commit '5b9cdf8cba114c41239bf0f9f5e0ccb6977d1c8d'
git bisect bad 6372c9dc9972318e75a5889ad6c52500b8294099
# skip: [5b9cdf8cba114c41239bf0f9f5e0ccb6977d1c8d] avconv: switch opening decoders and encoders
git bisect skip 5b9cdf8cba114c41239bf0f9f5e0ccb6977d1c8d
# bad: [6f69f7a8bf6a0d013985578df2ef42ee6b1c7994] Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
git bisect bad 6f69f7a8bf6a0d013985578df2ef42ee6b1c7994
# skip: [9200514ad8717c63f82101dc394f4378854325bf] lavf: replace AVStream.codec with AVStream.codecpar
git bisect skip 9200514ad8717c63f82101dc394f4378854325bf
# only skipped commits left to test
# possible first bad commit: [6f69f7a8bf6a0d013985578df2ef42ee6b1c7994] Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
# possible first bad commit: [9200514ad8717c63f82101dc394f4378854325bf] lavf: replace AVStream.codec with AVStream.codecpar

So looks like the bugger is in the merge commit FernetMenta pointed out. What's next?

comment:9 by Carl Eugen Hoyos, 8 years ago

Keywords: codecpar added
Status: newopen
Version: unspecifiedgit-master

comment:10 by Hendrik, 8 years ago

This ticket does not indicate how to reproduce it without kodi and some physical disc.
Samples? Steps to reproduce with ffmpeg only?

Whats an "invalid stream"?

Last edited 8 years ago by Hendrik (previous) (diff)

comment:11 by Michael Niedermayer, 8 years ago

Cc: Michael Niedermayer added

A wild guess is that you access some field after codecpar in AVStream.
You could test for this by moving codecpar to the end of AVStream.
Note though that these fields after codecpar where documented as non public

comment:12 by Michael Niedermayer, 8 years ago

If you need to access one of these fields, they should have accessor functions like av_stream_get_r_frame_rate() and av_stream_get_parser()

comment:13 by fritsch, 8 years ago

Here is a sample, that shows the issue: https://dl.dropboxusercontent.com/u/3669512/temp/Die%20Hard%202.tgz

When you reach VTS_01_0.VOB you hit the menu. Before 3.1 the AVFormatContext had all the available streams, after 3.1 bump the relevant are missing.

Visible issue: Selectors are missing (You don't see the extra options selected).

We are still debugging and might have different results later on. So far thx much for your help.

in reply to:  12 comment:14 by Hendrik, 8 years ago

Replying to michael:

If you need to access one of these fields, they should have accessor functions like av_stream_get_r_frame_rate() and av_stream_get_parser()

I think they build their own ffmpeg, so ABI issues should not be related.

in reply to:  13 comment:15 by Hendrik, 8 years ago

Replying to fritsch:

Visible issue: Selectors are missing (You don't see the extra options selected).

So we can't reproduce this without kodi? I don't really want to have to debug a foreign application first.

comment:16 by FernetMenta, 8 years ago

I debugged again and had a closer look. Sorry, I have missed some important info this morning (was too early :)

When looking at AVFormatContext, the streams info is correct in codecpar (at least codec_type shows AVMEDIA_TYPE_SUBTITLE) but not in deprecated codec.

Hope this helps. I have no idea how to reproduce with ffmpeg only.

comment:17 by Hendrik, 8 years ago

Hm that doesn't make much sense, st->codec is unconditionally initialized from st->codecpar after avformat_find_stream_info

Or are you relying on those streams being discovered during mid-playback at some point?

comment:18 by FernetMenta, 8 years ago

Yes, those streams are dicovered mid playback.

comment:19 by Hendrik, 8 years ago

Can you test if this patch helps?
https://bpaste.net/show/180ec28b8db5

comment:20 by popcornmix, 8 years ago

@heleppkes that patch does fix the Die Hard menu in Kodi for me

comment:21 by fritsch, 8 years ago

Same for me - the patch fixes the issue. Thanks much!

comment:22 by Carl Eugen Hoyos, 8 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.