diff mbox

[FFmpeg-devel] lavf/isom: support for demuxing MPEG-H 3D Audio in MP4

Message ID 1571299028-15927-1-git-send-email-Yuki.Tsuchiya@sony.com
State Superseded
Headers show

Commit Message

Yuki.Tsuchiya Oct. 17, 2019, 7:57 a.m. UTC
Implemented according to the specification at https://www.iso.org/standard/69561.html
The 'mhm1' sample entry is registered with MP4RA, which is defined as MHAS encapsulated single stream MPEG-H 3D Audio.
'MHAS' stands for MPEG-H audio stream, which contains encoded audio data and corresponds metadata for decoding.
This patch enables extracting the MHAS bitstream from MP4.

Signed-off-by: Yuki.Tsuchiya <Yuki.Tsuchiya@sony.com>
---
 Changelog               | 1 +
 libavcodec/avcodec.h    | 1 +
 libavcodec/codec_desc.c | 7 +++++++
 libavcodec/version.h    | 2 +-
 libavformat/isom.c      | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Oct. 17, 2019, 10:33 a.m. UTC | #1
> Am 17.10.2019 um 09:57 schrieb Yuki.Tsuchiya <Yuki.Tsuchiya@sony.com>:
> 
> Implemented according to the specification at https://www.iso.org/standard/69561.html
> The 'mhm1' sample entry is registered with MP4RA, which is defined as MHAS encapsulated single stream MPEG-H 3D Audio.
> 'MHAS' stands for MPEG-H audio stream, which contains encoded audio data and corresponds metadata for decoding.
> This patch enables extracting the MHAS bitstream from MP4.

Please provide a sample file.

If this patch allows remuxing with ffmpeg (I believe it does) but if the output file is not compatible with something that supports mpeg-h 3D audio, the patch has to be changed before it can be committed.

Carl Eugen
Yuki.Tsuchiya Oct. 30, 2019, 2:44 a.m. UTC | #2
Hi,
                                                                                                                                                                                
Here is the sample content of the MPEG-H 3D Audio.
https://www.filehosting.org/file/details/829625/mpeg-h_3d_audio_mhm1_sample.mp4

> If this patch allows remuxing with ffmpeg (I believe it does) but if the output file is not compatible with something that supports mpeg-h 3D audio, the patch has to be changed before it can be committed. 
I added some codes for copying mandatory boxes. I confirmed with following command that the remuxed.mp4 is compatible with MPEG-H 3D Audio standard.
                                                                                                                                                                                
  ffmpeg -i mpegh_3d_audio_mhm1_sample.mp4 -codec:a copy remuxed.mp4

Yuki.Tsuchiya (2):
  lavf/isom: support for demuxing MPEG-H 3D Audio in MP4
  lavf/movenc: cosmetics

 Changelog               |  1 +
 libavcodec/avcodec.h    |  1 +
 libavcodec/codec_desc.c |  7 +++++
 libavcodec/version.h    |  2 +-
 libavformat/isom.c      |  1 +
 libavformat/movenc.c    | 74 ++++++++++++++++++++++++++-----------------------
 libavformat/utils.c     |  3 +-
 7 files changed, 53 insertions(+), 36 deletions(-)
Carl Eugen Hoyos Nov. 6, 2019, 12:21 a.m. UTC | #3
Am Mi., 30. Okt. 2019 um 03:52 Uhr schrieb Yuki.Tsuchiya
<Yuki.Tsuchiya@sony.com>:

> Here is the sample content of the MPEG-H 3D Audio.
> https://www.filehosting.org/file/details/829625/mpeg-h_3d_audio_mhm1_sample.mp4

Does not work here, please use any other filehoster.

Thank you, Carl Eugen
Yuki.Tsuchiya Nov. 7, 2019, 8:38 a.m. UTC | #4
Hi Carl,

> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Carl

> Eugen Hoyo

> Does not work here, please use any other filehoster.


I have uploaded it to following, so please confirm.
https://wetransfer.com/downloads/f6d4468bf755909fb1592e600268930720191107082513/bdc63ea97eada0d939473109c3d4200c20191107082513/dca7fe
Carl Eugen Hoyos Nov. 21, 2019, 8:26 a.m. UTC | #5
Am Do., 7. Nov. 2019 um 09:38 Uhr schrieb Tsuchiya, Yuki (SHES)
<Yuki.Tsuchiya@sony.com>:
>
> Hi Carl,
>
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Carl
> > Eugen Hoyo
> > Does not work here, please use any other filehoster.
>
> I have uploaded it to following, so please confirm.
> https://wetransfer.com/downloads/f6d4468bf755909fb1592e600268930720191107082513/bdc63ea97eada0d939473109c3d4200c20191107082513/dca7fe

Sorry, I was traveling (in Japan), the link is gone;-(

Carl Eugen
Yuki.Tsuchiya Nov. 21, 2019, 10:03 a.m. UTC | #6
Hi Carl,

> On 2019/11/21 17:30, "ffmpeg-devel on behalf of Carl Eugen Hoyos" <ffmpeg-devel-bounces@ffmpeg.org on behalf of ceffmpeg@gmail.com> wrote:    

>    Sorry, I was traveling (in Japan), the link is gone;-(

Oh, let me know when you travel to japan again! :)

Here is new link.
https://wetransfer.com/downloads/4f8cba5a8ff25d79b20527b315b325f020191121095423/0a8ce1fce29f9b6e33fda7b5f6f9144920191121095424/4253d1
Carl Eugen Hoyos Nov. 21, 2019, 10:12 a.m. UTC | #7
Am Do., 21. Nov. 2019 um 11:03 Uhr schrieb Tsuchiya, Yuki (SHES)
<Yuki.Tsuchiya@sony.com>:
>
> Hi Carl,
>
> > On 2019/11/21 17:30, "ffmpeg-devel on behalf of Carl Eugen Hoyos" <ffmpeg-devel-bounces@ffmpeg.org on behalf of ceffmpeg@gmail.com> wrote:
> >    Sorry, I was traveling (in Japan), the link is gone;-(
> Oh, let me know when you travel to japan again! :)

https://www.videolan.org/videolan/events/vdd19/
Too bad you missed it.

> Here is new link.
> https://wetransfer.com/downloads/4f8cba5a8ff25d79b20527b315b325f020191121095423/0a8ce1fce29f9b6e33fda7b5f6f9144920191121095424/4253d1

Uploaded to samples/A-codecs/MPEGH3D/

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/Changelog b/Changelog
index 44e4184..2a79a1a 100644
--- a/Changelog
+++ b/Changelog
@@ -16,6 +16,7 @@  version <next>:
 - photosensitivity filter
 - anlms filter
 - arnndn filter
+- Support for demuxing MPEG-H 3D Audio in mp4
 
 
 version 4.2:
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index bcb931f..8c1a85d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -654,6 +654,7 @@  enum AVCodecID {
     AV_CODEC_ID_ATRAC9,
     AV_CODEC_ID_HCOM,
     AV_CODEC_ID_ACELP_KELVIN,
+    AV_CODEC_ID_MPEGH_3D_AUDIO,
 
     /* subtitle codecs */
     AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0602ecb..a970fae 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2998,6 +2998,13 @@  static const AVCodecDescriptor codec_descriptors[] = {
         .long_name = NULL_IF_CONFIG_SMALL("Sipro ACELP.KELVIN"),
         .props     = AV_CODEC_PROP_LOSSY,
     },
+    {
+        .id        = AV_CODEC_ID_MPEGH_3D_AUDIO,
+        .type      = AVMEDIA_TYPE_AUDIO,
+        .name      = "mpegh_3d_audio",
+        .long_name = NULL_IF_CONFIG_SMALL("MPEG-H 3D Audio"),
+        .props     = AV_CODEC_PROP_LOSSY,
+    },
 
     /* subtitle codecs */
     {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 2e047a6..0992d1e 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  59
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MICRO 103
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavformat/isom.c b/libavformat/isom.c
index edd0d81..c1a64c7 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -371,6 +371,7 @@  const AVCodecTag ff_codec_movaudio_tags[] = {
     { AV_CODEC_ID_FLAC,            MKTAG('f', 'L', 'a', 'C') }, /* nonstandard */
     { AV_CODEC_ID_TRUEHD,          MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */
     { AV_CODEC_ID_OPUS,            MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */
+    { AV_CODEC_ID_MPEGH_3D_AUDIO,  MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D Audio */
     { AV_CODEC_ID_NONE, 0 },
 };