[FFmpeg-user] amr_nb in mp4 container?

Ferdi Scholten ferdi at sttc-nlp.nl
Thu Feb 15 10:59:59 EET 2024


чт, 15 февр. 2024 г., 11:00 Andrew Randrianasulu <randrianasulu at gmail.com>:
>>
>> чт, 15 февр. 2024 г., 10:39 Ferdi Scholten<ferdi at sttc-nlp.nl>:
>>
>>> The AMR audio format is not specified as a valid audio format for the
>>> mp4 container (see *ISO
>>> < 
>>> https://en.wikipedia.org/wiki/International_Organization_for_Standardization>/IEC
>>>
>>> <https://en.wikipedia.org/wiki/International_Electrotechnical_Commission>
>>>
>>> 14496-14:2003)*. So managing to get it in does not mean it can be played
>>> or transcoded by other software that conforms to the mp4 specifications.
>>>
>>> Should you want it to be registered as such, you can do that here:
>>> https://mp4ra.org/request
>>> You can find all officially supported codecs and other streams on that
>>> site as well.
>>>
>> not sure if individuals can do anything about it?
>>
>> found this thread from 6 years ago
>>
>> https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-May/211446.html
>>
>
> anyway it does not mux correctly even in 3gp:
>
>
> ffmpeg -i
> /data/data/com.termux/files/home/storage/dcim/OpenCamera/VID_20240215_064913.mp4
> -c:a copy -c:v copy vid-test.3gp
>                            ffmpeg version 6.1.1 Copyright (c) 2000-2023 the
> FFmpeg developers
>   built with Android (10552028, +pgo, +bolt, +lto, -mlgo, based on r487747d)
> clang version 17.0.2 (
> https://android.googlesource.com/toolchain/llvm-project
> d9f89f4d16663d5012e5c09495f3b30ece3d2362)    configuration: --arch=aarch64
> --as=aarch64-linux-android-clang --cc=aarch64-linux-android-clang
> --cxx=aarch64-linux-android-clang++ --nm=llvm-nm
> --pkg-config=/home/builder/.termux-build/_cache/android-r26b-api-24-v1/bin/pkg-config
> --strip=llvm-strip --cross-prefix=aarch64-linux-android- --disable-indevs
> --disable-outdevs --enable-indev=lavfi --disable-static --disable-symver
> --enable-cross-compile --enable-gnutls --enable-gpl --enable-version3
> --enable-jni --enable-lcms2 --enable-libaom --enable-libass
> --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgme
> --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
> --enable-libopenmpt --enable-libopus --enable-librav1e --enable-libsoxr
> --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora
> --enable-libv4l2 --enable-libvidstab --enable-libvo-amrwbenc
> --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264
> --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
> --enable-mediacodec --enable-opencl --enable-shared
> --prefix=/data/data/com.termux/files/usr --target-os=android
> --extra-libs=-landroid-glob --disable-vulkan --enable-neon
> --disable-libfdk-aac
>
> libavutil      58. 29.100 / 58. 29.100
>
>   libavcodec     60. 31.102 / 60. 31.102
>
>     libavformat    60. 16.100 / 60. 16.100
>
>    libavdevice    60.  3.100 / 60.  3.100
>
>     libavfilter     9. 12.100 /  9. 12.100
>
>   libswscale      7.  5.100 /  7.  5.100
>
>   libswresample   4. 12.100 /  4. 12.100
>
>    libpostproc    57.  3.100 / 57.  3.100
>
>    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
> '/data/data/com.termux/files/home/storage/dcim/OpenCamera/VID_20240215_064913.mp4':
>
>   Metadata:
>
> major_brand     : mp42
>
> minor_version   : 0
>
> compatible_brands: isommp42
>
>   creation_time   : 2024-02-15T03:54:16.000000Z
>                          com.android.version: 11
>                                                Duration: 00:05:02.04, start:
> 0.000000, bitrate: 585 kb/s
>    Stream #0:0[0x1](eng): Video: h264 (Constrained Baseline) (avc1 /
> 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 640x480,
> 562 kb/s, SAR 1:1 DAR 4:3, 19.93 fps, 60 tbr, 90k tbn (default)
>
>
>    Metadata:
>                              creation_time   : 2024-02-15T03:54:16.000000Z
>                                                      handler_name    :
> VideoHandle
>        vendor_id       : [0][0][0][0]
>
> Stream #0:1[0x2](eng): Audio: amr_nb (samr / 0x726D6173), 8000 Hz, mono,
> fltp, 12 kb/s (default)     Metadata:
>                                                        creation_time   :
> 2024-02-15T03:54:16.000000Z
>        handler_name    : SoundHandle
>                                vendor_id       : [0][0][0][0]
>                                                 [3gp @ 0xb40000789b073d70]
> track 1: codec frame size is not set
> Output #0, 3gp, to 'vid-test.3gp':
>
> Metadata:
>
> major_brand     : mp42
>
> minor_version   : 0
>
> compatible_brands: isommp42
>                          com.android.version: 11
>                                                  encoder         :
> Lavf60.16.100
>      Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
> 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 640x480
> [SAR 1:1 DAR 4:3], q=2-31, 562 kb/s, 19.93 fps, 60 tbr, 90k tbn (default)
>
>
> Metadata:
>
>   creation_time   : 2024-02-15T03:54:16.000000Z
>
> handler_name    : VideoHandle
>
>   vendor_id       : [0][0][0][0]
>
> Stream #0:1(eng): Audio: amr_nb (samr / 0x726D6173), 8000 Hz, mono, fltp,
> 12 kb/s (default)          Metadata:
>                                                      creation_time   :
> 2024-02-15T03:54:16.000000Z
>        handler_name    : SoundHandle
>
> vendor_id       : [0][0][0][0]
>                   Stream mapping:
>                                            Stream #0:0 -> #0:0 (copy)
>                                                                   Stream
> #0:1 -> #0:1 (copy)
>
>   Press [q] to stop, [?] for help
>
>     [3gp @ 0xb40000789b073d70] fatal error, input is not a single packet,
> implement a AVParser for it  [vost#0:0/copy @ 0xb40000789b0730f0] Error
> submitting a packet to the muxer: Operation not permitted
>
>
>   [out#0/3gp @ 0xb40000784b074350] Error muxing a packet
>
>     [3gp @ 0xb40000789b073d70] fatal error, input is not a single packet,
> implement a AVParser for it  [out#0/3gp @ 0xb40000784b074350] Error writing
> trailer: Operation not permitted
> [out#0/3gp @ 0xb40000784b074350] video:27kB audio:2kB subtitle:0kB other
> streams:0kB global headers:0kB muxing overhead: unknown
>                                                    size=       0kB
> time=00:00:01.18 bitrate=   1.1kbits/s speed= 296x
>
> Conversion failed!
>
> ====
>
> so, bug?
>
>
>
Not a bug, that patch was never merged because these codecs are not part 
of the mp4 specification.
quote:

	So are you saying that there is no official specification for AMR in
	MP4, and these files are only compatible with your proprietary
	software?
	We generally require a proper specification to ensure we mux files that work.



Following the conversation it is apparent that ffmpeg does support AMR, 
but only in the containers that offer such support such as the MOV 
container for quicktime.

Quote from the conversation for that patch:

	"I resolved our issue with the MOV changes and now have H.264 / AMR-NB and
	H.264 / AMR-WB recording to MOV using non-patched FFmpeg.  The former plays
	in both QuickTime and the Windows 10 'Movies & TV' app, video and audio.
	The MOV containing AMR-WB plays video only in QuickTime and neither in the
	Windows 10 'Movies & TV' app.  This is equivalent to the MP4 files we
	record with our proposed patch."

So, use the right container! It should work for MOV containers. If it does not then it could be a bug.


More information about the ffmpeg-user mailing list