Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th May 2021, 08:37   #1  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
IPCM Audio, Indexers and FFMpeg (How to encode)

Hi there,
I've received some Slog3 HDR H.264 4:2:2 10bit planar FULL HD masterfiles with IPCM audio muxed in MP4.




IPCM is essentially a way of transporting a pcm_s24be (PCM signed 24-bit big-endian), so, technically speaking, it shouldn't be a big deal, however that's not the case.

By default, LWLibavAudioSource and FFAudioSource fail to decode it, in fact:

Code:
video=LWLibavVideoSource("Z:\IPCM_Sample.MP4")
audio=LWLibavAudioSource("Z:\IPCM_Sample.MP4")
AudioDub(video, audio)
outputs: LWLibavAudioSource failed to get audio track

and

Code:
video=FFVideoSource("Z:\IPCM_Sample.MP4")
audio=FFAudioSource("Z:\IPCM_Sample.MP4")
AudioDub(video, audio)
outputs: FFAudioSource audio codec not found


The expected behavior would be to decode IPCM as pcm_s24be (PCM signed 24-bit big-endian) but instead they both failed.

I turned to FFMpeg and to my surprise it also failed.

Code:
ffmpeg.exe -i %1 -acodec pcm_s24le -ar 48000 -ac 2 -y out1.wav
Error - Decoder (codec none) not found for input stream #0:1

The full logs are:

Code:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Z:\IPCM_Sample.MP4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 17440767
    compatible_brands: XAVCmp42iso2
    creation_time   : 2021-05-04T04:54:00.000000Z
  Duration: 00:00:10.08, start: 0.000000, bitrate: 80002 kb/s
    Stream #0:0(und): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p10le(pc), 1920x1080 [SAR 1:1 DAR 16:9], 46772 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc (default)
    Metadata:
      creation_time   : 2021-05-04T04:54:00.000000Z
      handler_name    : Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
    Stream #0:1(und): Audio: none (ipcm / 0x6D637069), 48000 Hz, stereo (default)
    Metadata:
      creation_time   : 2021-05-04T04:54:00.000000Z
      handler_name    : Sound Media Handler
      vendor_id       : [0][0][0][0]
    Stream #0:2(und): Data: none (rtmd / 0x646D7472), 4505 kb/s (default)
    Metadata:
      creation_time   : 2021-05-04T04:54:00.000000Z
      handler_name    : Timed Metadata Media Handler
      timecode        : 01:24:55:10
Stream mapping:
  Stream #0:1 -> #0:0 (? (?) -> pcm_s24le (native))
Decoder (codec none) not found for input stream #0:1
ffmpeg version 2021-05-05-git-7c451b609c
built on 05/05/2021 12:29 PM UTC+01:00



Actual workaround: manually setting the decoder to pcm_s24be PCM signed 24-bit big-endian makes it possible to decode the file correctly.

So this:

Code:
ffmpeg.exe -c:a pcm_s24be -i %1 -acodec pcm_s24le -ar 48000 -ac 2 -y out1.wav
works just fine:

Code:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Z:\IPCM_Sample.MP4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 17440767
    compatible_brands: XAVCmp42iso2
    creation_time   : 2021-05-04T04:54:00.000000Z
  Duration: 00:00:10.08, start: 0.000000, bitrate: 80002 kb/s
    Stream #0:0(und): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p10le(pc), 1920x1080 [SAR 1:1 DAR 16:9], 46772 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc (default)
    Metadata:
      creation_time   : 2021-05-04T04:54:00.000000Z
      handler_name    : Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
    Stream #0:1(und): Audio: pcm_s24be (ipcm / 0x6D637069), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2021-05-04T04:54:00.000000Z
      handler_name    : Sound Media Handler
      vendor_id       : [0][0][0][0]
    Stream #0:2(und): Data: none (rtmd / 0x646D7472), 4505 kb/s (default)
    Metadata:
      creation_time   : 2021-05-04T04:54:00.000000Z
      handler_name    : Timed Metadata Media Handler
      timecode        : 01:24:55:10
Stream mapping:
  Stream #0:1 -> #0:0 (pcm_s24be (native) -> pcm_s24le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'out1.wav':
  Metadata:
    major_brand     : XAVC
    minor_version   : 17440767
    compatible_brands: XAVCmp42iso2
    ISFT            : Lavf58.65.101
    Stream #0:0(und): Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2021-05-04T04:54:00.000000Z
      handler_name    : Sound Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc58.119.100 pcm_s24le
size=    2835kB time=00:00:10.06 bitrate=2306.5kbits/s speed= 196x
video:0kB audio:2835kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003514%

IPCM Sample: ​https://we.tl/t-UkEK5c94if
Decoded and re-encoded to PCM 24bit little endian audio: ​https://we.tl/t-4yTKInyzmt


After opening the bugs on both the LSMASH Works and FFMS2 GitHub repositories, I headed to the FFMpeg bug tracker in which I opened a ticket to report the bug...
I've already made a BAT to work around this but I wanted to share awareness if you receive an IPCM file so now you know what to do instead of wondering how you could decode it like I did for a few hours yesterday.
Hopefully it will be fixed in FFMpeg avformat and, as a consequence, in LWLibav and FFAudio as well and this little "guide" won't be needed anymore, but for the time being I hope it's gonna help.

Cheers,
Frank

Last edited by FranceBB; 29th July 2021 at 12:58.
FranceBB is offline   Reply With Quote
Old 7th May 2021, 11:13   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Thanks FranceBB for let we know that audio format supported in mp4 but than can't be played by lav filters (mpc-hc).

Just for add some info, I try to extract using MP4Box:
Quote:
MP4Box -raw 2: IPCM_Sample.MP4
[iso file] Unknown box type rtmd in parent stsd
[IsoMedia] Track 3 type rtmd not natively handled
Exporting PCM s24 SampleRate 48000 2 channels 24 bits per sample
And output a file IPCM_Sample_track2.ipcm

Loaded it in eac3to show:
Quote:
This might be a RAW/PCM file. Trying to figure out the details.
This will probably take a while. Please be patient...
The RAW/PCM file seems to be big endian.
The RAW/PCM file seems to have a bitdepth of 24 bits.
The RAW/PCM file seems to have 2 channels.
RAW/PCM, 2.0 channels, 0:00:10, 24 bits, 2304kbps, 48kHz
Also can be recoded to any format, without the detection, using:
eac3to IPCM.ipcm IPCM.flac -override -2 -24 -big -48000

Of course the audio is bit-identical to the obtained with:
Quote:
ffmpeg.exe -c:a pcm_s24be -i %1 -acodec pcm_s24le -ar 48000 -ac 2 -y out1.wav
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 7th May 2021, 11:43   #3  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
That's a nice trick. I didn't know that eac3to had the ability to analyze raw bitstream and actually understand what they are. Very nice indeed.
FranceBB is offline   Reply With Quote
Old 14th July 2021, 08:50   #4  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Sr for ask a question don't relate. How to encode with your h264 xavc and output result xavc format?? I encoded with your but output is avc not xavc
kedautinh12 is offline   Reply With Quote
Old 14th July 2021, 21:08   #5  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
What do you mean?
If you use the build and the command line provided it works. The fact that mediainfo doesn't display XAVC except for Intra Class 100 is only cause it's a string triggered by some values, so it's not a file metadata but the file itself is fine. It plays fine on Versio and it's recognised accordingly by AVID Media Composer.

Feel free to post the whole bat, if you want.
FranceBB is offline   Reply With Quote
Old 29th July 2021, 12:54   #6  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
As a quick update about the issue: Stephen (aka qyot27 for those who know him here on Doom9) submitted a patch to the FFMpeg developers to address the issue: http://ffmpeg.org/pipermail/ffmpeg-d...ly/282288.html
He also made an FFMpeg build with that patch included to address the issue: https://www.mediafire.com/file/7ttrj..._64bit.7z/file
We're now just waiting for the FFMpeg devs to merge it into the master so that both LSMASH and ffms2 will have the proper decoding.
FranceBB is offline   Reply With Quote
Old 14th August 2021, 12:48   #7  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
comment by richardpl

Resolution: → fixed
Status: open → closed

State Accepted


Yay!
We now have official support for IPCM in FFMpeg.

Last edited by FranceBB; 14th August 2021 at 13:30.
FranceBB is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:58.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.