Opened 10 years ago

Closed 10 years ago

#3366 closed defect (invalid)

Support muxing pcm_s16be to mp4

Reported by: Carl Eugen Hoyos Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mov
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

According to http://www.mp4ra.org/codecs.html pcm_s16be is supported in isom files.

$ ffmpeg -f s16be -i /dev/zero -acodec copy -t 1 out.mp4
ffmpeg version N-60304-g95d1809 Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb  2 2014 09:52:43 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.101 / 55. 49.101
  libavformat    55. 28.101 / 55. 28.101
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.101 /  4.  1.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.0 : mono
Input #0, s16be, from '/dev/zero':
  Duration: N/A, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16be, 44100 Hz, mono, s16, 705 kb/s
[mp4 @ 0x2a5f2c0] Could not find tag for codec pcm_s16be in stream #0, codec not currently supported in container
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf55.28.101
    Stream #0:0: Audio: pcm_s16be, 44100 Hz, mono, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Change History (7)

comment:1 by Carl Eugen Hoyos, 10 years ago

Description: modified (diff)
Summary: Support muxing pcm_s16le to mp4Support muxing pcm_s16be to mp4

comment:2 by muken, 10 years ago

MP4 file format itself has no support of 'raw ' and 'twos'.
These identifiers are defined in Motion JPEG 2000 file format (15444-3).
You need add the JP2 Signature Box at the start of file and add 'mjp2' brand into the File Type Box if muxing them.

By the way, we can mux raw audio into MP4 file format in the near future beacause an amendment of MPEG-4 Systems (14496-1) which adds objectTypeIndication (0x0C) and decoderSpecificInfo (RAWAudioConfig) of raw audio was published recently.
We only need to wait coding4CC, a 4 character code representing the parameters of the raw data as specified by the MPEG-4 Registration Authority, to be registered by http://www.mp4ra.org/codecs.html .

in reply to:  2 ; comment:3 by Carl Eugen Hoyos, 10 years ago

Replying to muken:

MP4 file format itself has no support of 'raw ' and 'twos'.

So what does "Sample Entry Codes Registered to ISO" means then?

These identifiers are defined in Motion JPEG 2000 file format (15444-3).
You need add the JP2 Signature Box at the start of file and add 'mjp2' brand into the File Type Box if muxing them.

But we don't do that currently for other codecs that we allow in isom or do I misunderstand?

in reply to:  3 comment:4 by muken, 10 years ago

Replying to cehoyos:

Replying to muken:

MP4 file format itself has no support of 'raw ' and 'twos'.

So what does "Sample Entry Codes Registered to ISO" means then?

Registered identifiers of CODEC for derived file formats of ISO Base Media file format (14496-12).
Vendors can avoid defining the same identifier by consulting this list.

These identifiers are defined in Motion JPEG 2000 file format (15444-3).
You need add the JP2 Signature Box at the start of file and add 'mjp2' brand into the File Type Box if muxing them.

But we don't do that currently for other codecs that we allow in isom or do I misunderstand?

What CODECs?
Some CODECs are defined under ISO Base Media file format (ISOBMFF), such as AC-3, Enhanced AC-3, DTS Audio, etc..., and not specific derived file formats.
ISOBMFF is designed to be used by derived file formats.
Branding 'isom' or later versions ('iso2', 'iso3', ... ) only is not preferred.
The specification of any derived file format shall define and document what CODECs are usable and how they are restricted in this file format.
You can see these definitions in all derived file formats (MP4 file formats , 3GPP, UltraViolet DECE Common File Format and so on).

For example.
DTS defines encapsulation of DTS Audio into ISOBMFF in #9302J81100.
Therefore, under all versions of ISOBMFF, you can mux DTS Audio without any restriction except for what #9302J81100 documents.
DECE Common File Format is derived from ISOBMFF and defines the encapsulation and the additional restrictions of DTS Audio according to #9302J81100.
Thus, you shall follow the restrictions of DECE Common File Format to encapsulate DTS Audio into DECE Common File Format.
If not, then it means there are incompatibilities inside the file i.e. out-of-spec.
You can't mux DTS Audio beyond the additional restrictions into DECE Common File Format.

About 'raw ' and 'twos', these identifiers are not defined in ISOBMFF but defined in Motion JPEG 2000.
Therefore, you can mux them as long as the destination file has compatibility of Motion JPEG 2000.
Note that you can make chimera of derived file formats as long as keeping all compatibility of them.

comment:5 by Carl Eugen Hoyos, 10 years ago

So is this an invalid ticket?

comment:6 by muken, 10 years ago

In the range of 'raw ' and 'twos' contexts, yes.
I don't know what kind of PCM audio is supported by MP4.
Just wait for the registrations in mp4ra.

comment:7 by Carl Eugen Hoyos, 10 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.