[Cin] pcm in mp4

Andrew Randrianasulu randrianasulu at gmail.com
Sun Nov 21 11:23:18 CET 2021


On Sunday, November 21, 2021, Andrew Randrianasulu <randrianasulu at gmail.com>
wrote:

> http://www.gdcl.co.uk/2013/02/15/PCM-in-MP4.html
>
> apparently way some muxers do it quite different from normal, so not as
> simple as adding codec_id to some table...
>
> On Sunday, November 21, 2021, Andrew Randrianasulu <
> randrianasulu at gmail.com> wrote:
>
>> from https://amp.reddit.com/r/ffmpeg/comments/ep61ig/uncompressed
>> _audio_in_mp4_workarounds_or_hacks/
>>
>> ====
>> You can use mp4box to mux PCM audio in MP4.
>>
>> If the audio is in a separate file,
>>
>> mp4box -add h264.mp4#video -add pcm.mov#audio -new h264pcm.mp4
>> If it's in the same file
>>
>> mp4box -add h264pcm.mov -new h264pcm.mp4
>> 2
>> Reply
>>
>> jvaratos
>> ·
>> 1y
>> Success! This works perfectly and premiere accepts the file with ease.
>> Thank you for this info!
>>
>> For those attempting similar things, I used FFMPEG to create a standalone
>> m4v file with a h.264 stream (encoded to my liking) as well as a mov file
>> containing just a PCM audio stream (mp4box would not accept a wav file for
>> some reason). Mp4box accepted both of those with the syntax mentioned above
>> and gave me a single mp4 file that premiere was happy with.
>>
>> ====
>>
>> may be ffmbc also accepts this. If 'support' was as simple as 'id case
>> somewhere' - we probably can patch our ffmpeg too
>>
>


compiled goac-1.0.1 on termux (no patches needed)

tested

Unrecognized option 'o'.
Error splitting the argument list: Option not found

$ ffmpeg -i ~/vid_20210828.mp4 -c:v copy -c:a pcm_s16le pcm.mov
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with Android (7714059, based on r416183c1) clang version 12.0.8 (
https://android.googlesource.com/toolchain/llvm-project
c935d99d7cf2016289302412d708641d52d2f7ee)
  configuration: --arch=armeabi-v7a --as=arm-linux-androideabi-clang
--cc=arm-linux-androideabi-clang --cxx=arm-linux-androideabi-clang++
--nm=llvm-nm
--pkg-config=/home/builder/.termux-build/_cache/android-r23b-api-24-v1/bin/pkg-config
--strip=llvm-strip --cross-prefix=arm-linux-androideabi- --disable-indevs
--disable-outdevs --enable-indev=lavfi --disable-static --disable-symver
--enable-cross-compile --enable-gnutls --enable-gpl --enable-libaom
--enable-libass --enable-libdav1d --enable-libmp3lame --enable-libfreetype
--enable-libvorbis --enable-libopus --enable-librav1e --enable-libsoxr
--enable-libx264 --enable-libx265 --enable-libxvid --enable-libvidstab
--enable-libvpx --enable-libwebp --enable-libxml2 --enable-shared
--prefix=/data/data/com.termux/files/usr --target-os=android
--extra-libs=-landroid-glob --enable-neon
  libavutil 56. 70.100 / 56. 70.100
  libavcodec 58.134.100 / 58.134.100
  libavformat 58. 76.100 / 58. 76.100
  libavdevice 58. 13.100 / 58. 13.100
  libavfilter 7.110.100 / 7.110.100
  libswscale 5. 9.100 / 5. 9.100
  libswresample 3. 9.100 / 3. 9.100
  libpostproc 55. 9.100 / 55. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/data/data/com.termux/files/home/vid_20210828.mp4':
  Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    encoder : Lavf58.76.100
  Duration: 00:00:16.75, start: 0.000000, bitrate: 685 kb/s
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
unknown/bt470bg/unknown), 640x480 [SAR 27:64 DAR 9:16], 547 kb/s, 29.61
fps, 29.61 tbr, 18k tbn, 59.21 tbc (default)
    Metadata:
      handler_name : VideoHandle
      vendor_id : [0][0][0][0]
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 129 kb/s (default)
    Metadata:
      handler_name : SoundHandle
      vendor_id : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'pcm.mov':
  Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    encoder : Lavf58.76.100
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
unknown/bt470bg/unknown), 640x480 [SAR 27:64 DAR 9:16], q=2-31, 547 kb/s,
29.61 fps, 29.61 tbr, 18k tbn, 18k tbc (default)
    Metadata:
      handler_name : VideoHandle
      vendor_id : [0][0][0][0]
  Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo,
s16, 1536 kb/s (default)
    Metadata:
      handler_name : SoundHandle
      vendor_id : [0][0][0][0]
      encoder : Lavc58.134.100 pcm_s16le
frame= 3 fps=0.0 q=-1.0 size= 0kB time=00:00:00.00 bitrate=514frame= 496
fps=0.0 q=-1.0 Lsize= 4270kB time=00:00:16.70 bitrate=2094.2kbits/s speed=
133x
video:1120kB audio:3136kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.341275%
$ mediainfo pcm.mov
General
Complete name : pcm.mov
Format : MPEG-4
Format profile : QuickTime
Codec ID : qt 0000.02 (qt )
File size : 4.17 MiB
Duration : 16 s 754 ms
Overall bit rate : 2 088 kb/s
Writing application : Lavf58.76.100

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High at L3
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 16 s 754 ms
Bit rate : 547 kb/s
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 0.563
Original display aspect ratio : 0.562
Frame rate mode : Constant
Frame rate : 29.605 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.060
Stream size : 1.09 MiB (26%)
Title : VideoHandle
Writing library : x264 core 161
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 /
me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 /
chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1
/ chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0
/ nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0
/ bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 /
open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 /
intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 /
qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language : English
Color range : Limited
Color primaries : BT.601 PAL
Codec configuration box : avcC

Audio
ID : 2
Format : PCM
Format settings : Little / Signed
Codec ID : sowt
Duration : 16 s 726 ms
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 3.06 MiB (73%)
Title : SoundHandle
Language : English
Default : Yes
Alternate group : 1


$ bin/gcc/MP4
MP4Box MP4Client
$ bin/gcc/MP4Box -add pcm.mov -new h264_pcm.mp4
Cannot create directory "/tmp/gpac_cache": last error 2
IsoMedia import pcm.mov - track ID 1 - Video (size 640 x 480)
IsoMedia import pcm.mov - track ID 2 - Audio (SR 48000 - 2 channels)
Saving h264_pcm.mp4: 0.500 secs Interleaving
$ mediainfo h264_pcm.mp4
General
Complete name : h264_pcm.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom)
File size : 4.16 MiB
Duration : 16 s 754 ms
Overall bit rate : 2 084 kb/s
Encoded date : UTC 2021-11-21 10:19:43
Tagged date : UTC 2021-11-21 10:19:43

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High at L3
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 16 s 754 ms
Bit rate : 547 kb/s
Maximum bit rate : 795 kb/s
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 0.563
Original display aspect ratio : 0.562
Frame rate mode : Constant
Frame rate : 29.605 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.060
Stream size : 1.09 MiB (26%)
Title : VideoHandle
Writing library : x264 core 161
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 /
me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 /
chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1
/ chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0
/ nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0
/ bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 /
open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 /
intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 /
qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Tagged date : UTC 2021-11-21 10:19:43
Color range : Limited
Color primaries : BT.601 PAL
Codec configuration box : avcC

Audio
ID : 2
Format : PCM
Format settings : Little / Signed
Codec ID : sowt
Duration : 16 s 726 ms
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 3.06 MiB (74%)
Title : SoundHandle
Default : Yes
Alternate group : 1
Tagged date : UTC 2021-11-21 10:19:43


$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211121/e7a88085/attachment-0001.htm>


More information about the Cin mailing list