[Cin] tried multichannel mp2 encoding!
Andrew Randrianasulu
randrianasulu at gmail.com
Thu Jan 25 14:49:13 CET 2024
Header: it seems that default mplex can mux 3 min test multichannel
mpeg audio (mp2) audio just fine ...
https://cloud.mail.ru/public/v5K7/5gRpkx25k - 9 mb mp2 file
so I basically did DVD with cinelerra-gg from matrixbench clip (w/ ac3
sound from samples .mplayerhq.hu)
then I rendered out audio separately in AIFF. sadly libsndfile
defaults to new compressed AIFF.
sox repacked it into older format encoder understand
sox /dev/shm/dvd_20240125-144543/dvd.aif
/dev/shm/dvd_20240125-144543/dvd.aiff
=======
encoder run:
/home/guest/botva/src/src/mctoolame-01a/mctoolame -x 1 -y 2 -D -L -w
/dev/shm/dvd_20240125-144543/dvd.aiff
bash-5.1$ /home/guest/botva/src/src/mctoolame-01a/mctoolame -x 1 -y 2
-D -L -w /dev/shm/dvd_20240125-144543/dvd.aiff
ISO MPEG Audio Subgroup Software Simulation Group (1996)
ISO 13818-3 MPEG-2 Audio Multichannel Encoder
$Revision: 2.0 $
Num. ch: 6
Sample frames 9006723
Sample size in bits 16
Sample rate 48000.000000
Sound data is not PCM in "/dev/shm/dvd_20240125-144543/dvd.aiff".
>>> Using 3/2 configuration.
Encoding configuration:
Layer=II mode=stereo extn=0 psy model=1
samp frq=48.0 kHz mpeg1 bitrate=384 kbps
No multilingual coding.
de-emph=0 c/right=0 orig=0 errprot=0
matrix=1 center=1 surround=2 stereo=2 stereomc=3 stereoaug=0
input file: '/dev/shm/dvd_20240125-144543/dvd.aiff' output file:
'/dev/shm/dvd_20240125-144543/dvd.aiff.mp2'
Then decoder run:
bash-5.1$ /home/guest/botva/src/src/lamedecoder/mctoolamed
/dev/shm/dvd_20240125-144543/dvd.aiff
ISO MPEG Audio Subgroup Software Simulation Group (1996)
ISO 13818-3 MPEG-2 Audio Multichannel Decoder
$Revision: 2.2 $
Could not find "/dev/shm/dvd_20240125-144543/dvd.aiff.ext".
No extension bitstream </dev/shm/dvd_20240125-144543/dvd.aiff.ext> present
Input file = '/dev/shm/dvd_20240125-144543/dvd.aiff.mp2'
Output file = '/dev/shm/dvd_20240125-144543/dvd.aiff.aiff' >>>
A MPEG 2 Layer-1/2 bitstream will be decoded
Output file written in AIFF format
the bit stream file /dev/shm/dvd_20240125-144543/dvd.aiff.mp2 is a BINARY file
HDR: s=FFF, id=1, l=2, ep=1, br=E, sf=1, pd=0, pr=0, m=0, js=0, c=0, o=0, e=0
layer=II, MPEG1-bitrate=384, sfrq=48.0, mode=stereo, sblim=27,
jsbd=27, MPEG1-ch=2
mc-channel=3, MPEG2-ext-length=0 kbit/s lfe-channel present
LFE file written in AIFF format
initialising 5 output files
next mpg header not found
Frame cannot be located, end of input stream
Decoding of "/dev/shm/dvd_20240125-144543/dvd.aiff.mp2" with 7819
frames is finished
The decoded PCM output file name is "/dev/shm/dvd_20240125-144543/dvd.aiff.aiff"
"/dev/shm/dvd_20240125-144543/dvd.aiff.aiff" has been written with
AIFF header information
==========
then test audio (-P mode, predictive, seems to be broken in encoder)
bash-5.1$ cin /dev/shm/dvd_20240125-144543/dvd.aiff.aiff
/dev/shm/dvd_20240125-144543/dvd.aiff_lfe.dec
Cinelerra Infinity - built: Dec 22 2023 12:26:23
git://git.cinelerra-gg.org/goodguy/cinelerra.git
(c) 2006-2019 Heroine Virtual Ltd. by Adam Williams
2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy
2003-2017 mods for Cinelerra-CV by CinelerraCV team
2015-2023 mods for Cinelerra-GG by Cinelerra-GG team
Libav version: Lavc60.31.102
Cinelerra is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. There is absolutely no warranty for Cinelerra.
RenderFarmClient::main_loop: client started
AudioALSA::write_buffer err -32(Broken pipe) at sample 6275072
Total excess of backups: -50
Session time: 0:06:27
Cpu time: user: 0:00:23.504 sys: 0:00:05.709
move LFE to track 3 I think.
=========
move file so mplex will recognize it
bash-5.1$ mv /dev/shm/dvd_20240125-144543/dvd.aiff.mp2
/dev/shm/dvd_20240125-144543/dvd.mp2
bash-5.1$ /dev/shm/dvd_20240125-144543/dvd.sh
running /dev/shm//dvd_20240125-144543/dvd.sh
INFO: [mplex] mplex version 2.2.1 (2.2.7 $Date: 2012-11-17 01:55:16 $)
INFO: [mplex] File /dev/shm/dvd_20240125-144543/dvd.m2v looks like
an MPEG Video stream.
INFO: [mplex] File /dev/shm/dvd_20240125-144543/dvd.mp2 looks like
an MPEG Audio stream.
INFO: [mplex] Video stream 0: profile 8 selected - ignoring
non-standard options!
INFO: [mplex] Found 1 audio streams, 1 video streams and 0 subtitle streams
INFO: [mplex] Selecting dvdauthor DVD output profile
INFO: [mplex] Multiplexing video program stream!
INFO: [mplex] Scanning for header info: Video stream e0
(/dev/shm/dvd_20240125-144543/dvd.m2v)
INFO: [mplex] VIDEO STREAM: e0
INFO: [mplex] Frame width : 720
INFO: [mplex] Frame height : 576
INFO: [mplex] Aspect ratio : 4:3 display
INFO: [mplex] Picture rate : 25.000 frames/sec
INFO: [mplex] Bit rate : 8000000 bits/sec
INFO: [mplex] Vbv buffer size : 229376 bytes
INFO: [mplex] CSPF : 0
INFO: [mplex] Scanning for header info: Audio stream c0
(/dev/shm/dvd_20240125-144543/dvd.mp2)
INFO: [mplex] MPEG AUDIO STREAM: c0
INFO: [mplex] Audio version : 1.0
INFO: [mplex] Layer : 2
INFO: [mplex] CRC checksums : no
INFO: [mplex] Bit rate : 49152 bytes/sec (384 kbit/sec)
INFO: [mplex] Frequency : 48000 Hz
INFO: [mplex] Mode : 0 stereo
INFO: [mplex] Mode extension : 0
INFO: [mplex] Copyright bit : 0 no copyright
INFO: [mplex] Original/Copy : 0 copy
INFO: [mplex] Emphasis : 0 none
INFO: [mplex] SYSTEMS/PROGRAM stream:
INFO: [mplex] rough-guess multiplexed stream data rate : 8566496
INFO: [mplex] target data-rate specified : 10080000
INFO: [mplex] Setting specified specified data rate: 10080000
INFO: [mplex] Run-in delay = 7200 Video delay = 7200 Audio delay = 10800
INFO: [mplex] New sequence commences...
INFO: [mplex] Video e0: buf= 0 frame=000000 sector=00000000
INFO: [mplex] Audio c0: buf= 0 frame=000000 sector=00000000
INFO: [mplex] Scanned to end AU 4690
INFO: [mplex] STREAM e0 completed
INFO: [mplex] STREAM c0 completed
INFO: [mplex] Multiplex completion at SCR=16893513.
INFO: [mplex] Video e0: completed
INFO: [mplex] Audio c0: completed
INFO: [mplex] VIDEO_STATISTICS: e0
INFO: [mplex] Video Stream length: 185629369 bytes
INFO: [mplex] Sequence headers: 313
INFO: [mplex] Sequence ends : 1
INFO: [mplex] No. Pictures : 4691
INFO: [mplex] No. Groups : 313
INFO: [mplex] No. I Frames : 313 avg. size 55155 bytes
INFO: [mplex] No. P Frames : 4378 avg. size 38457 bytes
INFO: [mplex] No. B Frames : 0 avg. size 0 bytes
INFO: [mplex] Average bit-rate : 7914000 bits/sec
INFO: [mplex] Peak bit-rate : 9047200 bits/sec
INFO: [mplex] BUFFERING min 15 Buf max 176717
INFO: [mplex] AUDIO_STATISTICS: c0
INFO: [mplex] Audio stream length 9007488 bytes.
INFO: [mplex] Syncwords : 7819
INFO: [mplex] Frames : 7819 padded
INFO: [mplex] Frames : 0 unpadded
INFO: [mplex] BUFFERING min 15 Buf max 1163
INFO: [mplex] MUX STATUS: no under-runs detected.
DVDAuthor::dvdauthor, version 0.7.2.
Build options: gnugetopt imagemagick iconv freetype fribidi fontconfig
Send bug reports to <dvdauthor-users at lists.sourceforge.net>
INFO: default video format is PAL
INFO: dvdauthor creating VTS
STAT: Picking VTS 01
STAT: Processing /dev/shm/dvd_20240125-144543/dvd.mpg...
STAT: VOBU 304 at 182MB, 1 PGCs
INFO: Video pts = 0.120 .. 187.760
INFO: Audio[8] pts = 0.120 .. 187.776
STAT: VOBU 313 at 188MB, 1 PGCs
CHAPTERS: VTS[1/1] 0.000
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x576
INFO: Audio ch 0 format: mp2/2ch, 48khz 20bps, 'en'
STAT: fixed 313 VOBUs
INFO: dvdauthor creating table of contents
INFO: Scanning /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_0.IFO
To burn dvd, load blank media and run:
growisofs -dvd-compat -Z /dev/dvd -dvd-video /dev/shm/dvd_20240125-144543/iso
Завершено
dvd.sh was modded so it look fr m2 instead of ac3
=================
Test in mpv:
bash-5.1$ mpv /dev/shm/dvd_20240125-144543/iso
[file] This is a directory - adding to playlist.
Playing: /dev/shm/dvd_20240125-144543/iso/AUDIO_TS
[file] This is a directory - adding to playlist.
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS
[file] This is a directory - adding to playlist.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VIDEO_TS.BUP
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VIDEO_TS.IFO
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_0.BUP
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_0.IFO
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_1.VOB
(+) Video --vid=1 (mpeg2video 720x576 25.000fps)
(+) Audio --aid=1 (mp2 2ch 48000Hz)
AO: [alsa] 48000Hz stereo 2ch s16
VO: [gpu] 720x576 => 768x576 yuv420p
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
AV: 00:00:28.680 / 00:03:07.632 (15%) A-V: 0.000
Exiting... (Quit)
bash-5.1$ mpv -af volume=20 /dev/shm/dvd_20240125-144543/iso
[file] This is a directory - adding to playlist.
Playing: /dev/shm/dvd_20240125-144543/iso/AUDIO_TS
[file] This is a directory - adding to playlist.
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS
[file] This is a directory - adding to playlist.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VIDEO_TS.BUP
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VIDEO_TS.IFO
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_0.BUP
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_0.IFO
Failed to recognize file format.
Playing: /dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_1.VOB
(+) Video --vid=1 (mpeg2video 720x576 25.000fps)
(+) Audio --aid=1 (mp2 2ch 48000Hz)
AO: [alsa] 48000Hz stereo 2ch float
VO: [gpu] 720x576 => 768x576 yuv420p
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
[ffmpeg/audio] mp2: Header missing
Error decoding audio.
AV: 00:01:29.800 / 00:03:07.632 (48%) A-V: 0.000
Exiting... (Quit)
==========
copy mp2 file out from VOB by ffmpeg:
bash-5.1$ ffmpeg -i
/dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_1.VOB -c:a copy -vn
copy.mp2
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 11.2.0 (GCC)
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib
--docdir=/usr/doc/ffmpeg-4.4.4/html --mandir=/usr/man --disable-debug
--enable-shared --disable-static --enable-gpl --enable-version3
--enable-avresample --arch=i586 --enable-libfontconfig
--enable-libfreetype --enable-libfribidi --enable-gnutls
--enable-libass --enable-libbluray --enable-libcdio --enable-frei0r
--enable-libgsm --enable-openal --enable-libopus --enable-librtmp
--enable-libsnappy --enable-libspeex --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libv4l2
--enable-libvidstab --enable-libvorbis --enable-libvpx
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid
--enable-libmp3lame --enable-opencl --enable-opengl
--enable-libopenjpeg --disable-libpulse --enable-libsmbclient
--enable-libsvtav1 --enable-libxml2 --enable-librsvg --enable-libdrm
--enable-libaom --enable-libdav1d --enable-libsoxr --enable-libzimg
--enable-vapoursynth
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
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mpeg, from '/dev/shm/dvd_20240125-144543/iso/VIDEO_TS/VTS_01_1.VOB':
Duration: 00:03:07.63, start: 0.120000, bitrate: 8435 kb/s
Stream #0:0[0x1bf]: Data: dvd_nav_packet
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg,
top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50
tbc
Side data:
cpb: bitrate max/min/avg: 8000000/0/0 buffer size: 1835008 vbv_delay: N/A
Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
File 'copy.mp2' already exists. Overwrite? [y/N] y
Output #0, mp2, to 'copy.mp2':
Metadata:
encoder : Lavf58.76.100
Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
Stream mapping:
Stream #0:2 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 8796kB time=00:03:07.63 bitrate= 384.0kbits/s speed=1.4e+03x
video:0kB audio:8796kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.000000%
====
Decode it:
bash-5.1$ /home/guest/botva/src/src/lamedecoder/mctoolamed copy
ISO MPEG Audio Subgroup Software Simulation Group (1996)
ISO 13818-3 MPEG-2 Audio Multichannel Decoder
$Revision: 2.2 $
Could not find "copy.ext".
No extension bitstream <copy.ext> present
Input file = 'copy.mp2'
Output file = 'copy.aiff' >>>
A MPEG 2 Layer-1/2 bitstream will be decoded
Output file written in AIFF format
the bit stream file copy.mp2 is a BINARY file
HDR: s=FFF, id=1, l=2, ep=1, br=E, sf=1, pd=0, pr=0, m=0, js=0, c=0, o=0, e=0
layer=II, MPEG1-bitrate=384, sfrq=48.0, mode=stereo, sblim=27,
jsbd=27, MPEG1-ch=2
mc-channel=3, MPEG2-ext-length=0 kbit/s lfe-channel present
LFE file written in AIFF format
initialising 5 output files
next mpg header not found
Frame cannot be located, end of input stream
Decoding of "copy.mp2" with 7819 frames is finished
The decoded PCM output file name is "copy.aiff"
"copy.aiff" has been written with AIFF header information
==========
test it again
cin copy.aiff copy_lfe.dec
Cinelerra Infinity - built: Dec 22 2023 12:26:23
git://git.cinelerra-gg.org/goodguy/cinelerra.git
(c) 2006-2019 Heroine Virtual Ltd. by Adam Williams
2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy
2003-2017 mods for Cinelerra-CV by CinelerraCV team
2015-2023 mods for Cinelerra-GG by Cinelerra-GG team
Libav version: Lavc60.31.102
Cinelerra is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. There is absolutely no warranty for Cinelerra.
RenderFarmClient::main_loop: client started
Total excess of backups: -50
Session time: 0:01:12
Cpu time: user: 0:00:09.453 sys: 0:00:01.637
===========
both encoder and decoder should work on 64 bit machines, but LE
(little endian) only at the moment!
src
https://github.com/Randrianasulu/mctoolame-experiments-enc
https://github.com/Randrianasulu/mctoolame-experiments
get files, run 'make' in their roots. (makefile may need some tweaking)
More information about the Cin
mailing list