Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem handling MPEG-1 audio. #905

Closed
Canta opened this issue Mar 4, 2021 · 2 comments
Closed

Problem handling MPEG-1 audio. #905

Canta opened this issue Mar 4, 2021 · 2 comments
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@Canta
Copy link
Contributor

Canta commented Mar 4, 2021

System info

Operating System: Ubuntu 20.04
Shaka Packager Version: f0a52cb

Issue and steps to reproduce the problem

The issue is simple: while trying to test the new DVBSUB functionality on a file I got from internet, shaka-packager fails.
@kqyang mentioned in #903 that this is a MPEG-1 audio handling problem, and should be dealt within a different ticket, so I create this one.

Here are the steps to reproduce the problem:

  1. Download https://cs1.ssltrust.me/s/vR791a3ebbJio49 (workplace warning: subtitles contains adult language)
  2. Run the packager command in the same dir the file was downloaded.

Packager Command:

/path/to/packager \
'in=file3.ts,stream=0,init_segment=1080p_init.mp4,segment_template=1080p_$Number$.m4s,playlist_name=1080p.m3u8' \
'in=file3.ts,stream=1,skip_encryption=1,init_segment=audio_init_0.mp4,segment_template=audio_0_$Number$.m4s,hls_name=POL,playlist_name=audio0.m3u8' \
'in=file3.ts,stream=2,skip_encryption=1,init_segment=audio_init_1.mp4,segment_template=audio_1_$Number$.m4s,hls_name=EN,playlist_name=audio1.m3u8' \
'in=file3.ts,stream=3,skip_encryption=1,format=ttml+mp4,init_segment=text_init.mp4,segment_template=text_$Number$.mp4,playlist_name=text.m3u8' \
--hls_master_playlist_output playlist.m3u8 \
--hls_playlist_type LIVE \
--default_language pol \
--default_text_language pol \
--time_shift_buffer_depth 60

What is the expected result?:
Some segments and playlists.

What happens instead?:

[0302/181526:INFO:demuxer.cc(89)] Demuxer::Run() on file 'file3.ts'.
[0302/181526:INFO:demuxer.cc(155)] Initialize Demuxer for file 'file3.ts'.
[0302/181526:FATAL:bit_writer.cc(18)] Check failed: bits < 1ULL << number_of_bits (33 vs. 32)
#0 0x0000004a07ee base::debug::StackTrace::StackTrace()
#1 0x00000044a4cf logging::LogMessage::~LogMessage()
#2 0x000000f9ea56 shaka::media::BitWriter::WriteBits()
#3 0x000000d72ee6 shaka::media::mp2t::Mpeg1Header::GetAudioSpecificConfig()
#4 0x000000d55d4a shaka::media::mp2t::EsParserAudio::UpdateAudioConfiguration()
#5 0x000000d5558f shaka::media::mp2t::EsParserAudio::Parse()
#6 0x000000d4c636 shaka::media::mp2t::TsSectionPes::ParseInternal()
#7 0x000000d4a433 shaka::media::mp2t::TsSectionPes::Emit()
#8 0x000000d4a261 shaka::media::mp2t::TsSectionPes::Parse()
#9 0x000000d32b35 shaka::media::mp2t::PidState::PushTsPacket()
#10 0x000000d3475b shaka::media::mp2t::Mp2tMediaParser::Parse()
#11 0x000000d23a78 shaka::media::Demuxer::InitializeParser()
#12 0x000000d22875 shaka::media::Demuxer::Run()
#13 0x000000682f1c shaka::media::Job::Run()
#14 0x000000586cd9 base::SimpleThread::ThreadMain()
#15 0x00000048660a base::(anonymous namespace)::ThreadFunc()
#16 0x7ff052cdb609 start_thread
#17 0x7ff052c02293 clone

Aborted (core dumped)
@kqyang
Copy link
Contributor

kqyang commented Mar 4, 2021

@Canta Thanks for the bug report. Will you be interested in sending a PR to fix the bug?

The code at https://github.com/google/shaka-packager/blob/2909ca0c774dd9530ee188b1de499c7eef8e91d6/packager/media/formats/mp2t/mpeg1_header.cc#L199 is incorrect as the object type is more than 5 bits.

Here is the definition in the spec (ISO/IEC 14496:3 Table 1.16):

Syntax No. of bits
audioObjectType; 5
if (audioObjectType == 31) {
audioObjectType = 32 + audioObjectTypeExt; 6
}

So we'll need to do:

// ISO/IEC 14496:3 Table 1.16 Syntax of GetAudioObjetType()
auto object_type = GetObjectType();
if (object_type <= 31) {
  config.WriteBits(object_type, 5); 
} else {
  config.WriteBits(31, 5); 
  config.WriteBits(object_type - 32, 6); 
}

@kqyang kqyang added type: bug Something isn't working correctly and removed needs triage labels Mar 4, 2021
@shaka-bot shaka-bot added this to the v2.5 milestone Mar 4, 2021
@Canta
Copy link
Contributor Author

Canta commented Mar 5, 2021

I'll be happy to help. Yet, can't focus on this right now, as I have other pressing matters I need to solve first. Most likely will do this next week.

Canta pushed a commit to Canta/shaka-packager that referenced this issue Mar 17, 2021
@kqyang kqyang closed this as completed in f6c02e6 Apr 5, 2021
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Jun 4, 2021
@shaka-project shaka-project locked and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants