axiomatic-systems / Bento4

Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
http://www.bento4.com
2.03k stars 483 forks source link

mp42ts : ac-4 "Error: audio codec not supported" #969

Open nicolas-chabanis opened 5 months ago

nicolas-chabanis commented 5 months ago

Hello, trying to convert a fragmented mp4 file with AC-4 audio into a ts file using mp42ts gives me "Error: audio codec not supported". I used this command : mp42ts.exe --verbose .\concat.mp4 .\concat.ts File : https://github.com/axiomatic-systems/Bento4/assets/60547622/61159e3f-b9cd-4ddf-8475-f1f2e875b9ca mp4info shows me this :

File:
  major brand:      M4A
  minor version:    0
  compatible brand: dash
  compatible brand: cmf2
  compatible brand: iso6
  fast start:       yes

Movie:
  duration:   0 (movie timescale units)
  duration:   0 (ms)
  time scale: 48000
  fragments:  yes

Found 1 Tracks
Track 1:
  flags:        7 ENABLED IN-MOVIE IN-PREVIEW
  id:           1
  type:         Audio
  duration: 0 ms
  language: fre
  media:
    sample count: 0
    timescale:    48000
    duration:     0 (media timescale units)
    duration:     0 (ms)
    bitrate (computed): 47.653 Kbps
    sample count with fragments: 159
    duration with fragments:     305280
    duration with fragments:     6360 (ms)
  Sample Description 0
    Bytes: 000000000000000100000000000000000002001000000000bb800000000000286461633420a401400000001fffffffe00112f880000042000002501000000310999c8080
    Coding:       ac-4 (Dolby AC-4)
    Codec String: ac-4.02.01.00
    Sample Rate: 48000
    Sample Size: 16
    Channels:    2
    Codecs String: ac-4.02.01.00
    AC-4 dsi version: 1
    AC-4 bitstream version: 2
    AC-4 Presentation 0:
        Stream Type = Channel based
        presentation_id = 0
        Codec String = ac-4.02.01.00
        presentation_channel_mask_v1 = 0x1
        Dolby Atmos source = No
        Language = fr
        Self Contained = Yes
    Self Contained: Yes
    AC-4 dac4 payload: [20a401400000001fffffffe00112f880000042000002501000000310999c8080]

Is there something I am doing wrong ? Thanks !

barbibulle commented 5 months ago

Hi. You are not going anything wrong. It's just that support for AC-4 in MPEG2TS containers is not currently supported. Most users of this software tend to have use cases that involve creating MPEG DASH or HLS presentations, including with AC-4 audio content, but in that case the container format is MP4, not MPEG2TS, so the need to support AC-4 in MPEG2TS has not been required so far. Do you think this is something the would be generally useful? Can you describe your use case?

nicolas-chabanis commented 5 months ago

Hi, I get that there is no obvious use-case to support AC-4 in MPEG2TS. What I am trying to do is to know whether the first AC-4 frame in my MP4 segment is a AC-4 I-Frame, so that the segment can be decoded without artifacts, as specified in the Dolby AC-4 specifications (in my case, the MP4 segment is composed of an init segment and multiple fragmented segments). Since I have not succeeded in retrieving that information just by looking at the MP4 boxes, I'm trying to convert the segment to a MPEG2TS segment, where another tool has proven to be able to give me this information. Maybe there is a way for you to help me on this ?