With HDV 'in the Blu-ray box' I would like to test if it possible to use
equivalent procedures for DV to SD-Blu-ray video.
That is continue as an alternative to the 2021 thread here:
https://lists.cinelerra-gg.org/pipermail/cin/2021-December/004268.html
Blu-ray compliant MPEG-2 SD video with LPCM audio
-------------------------------------------------
1) Encode DV to MPEG-2 video and copy PCM audio as is to a VOB/MPG format:
ffmpeg -i dv28.dv -c:v mpeg2video -refs 1 -bf 2 -b:v 25M -maxrate 25M
-minrate 25M -bufsize 45M -muxrate 45M -dc 10 -c:a pcm_s16be -f vob
dv28_25mbps.mpg
2) tsMuxer
As FFMpeg (then) would not allow to mux PCM or remux MPG to M2TS, I
tested tsMuxer,
see the attached screenshot: tsMuxer_SD_M2TS
Input file: dv28_25mbps.mpg
Tracs: MPEG-2 video stream and LPCM audio stream
Output: dv28_25mbps.iso
------------------------
Using Mediainfo to compare the source dv28.dv ffmpeg input file with its
output file dv28_25mbps.mpg (intermediate) and with the resulting
dv28_25mbps.iso, show that the interlaced dv video was changed to
progressive VOB/BVOB dvd video.
> mediainfo dv28.dv | egrep 'Format|Scan|Width|Height|Bit'
Format : DV
Format : DV
Bit rate mode : Constant
Bit rate : 24.4 Mb/s
Width : 720 pixels
Height : 576 pixels
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Bottom Field First
Bits/(Pixel*Frame) : 2.357
Format : PCM
Format settings : Big / Signed
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Bit depth : 16 bits
> mediainfo dv28_25mbps.mpg | egrep 'Format|Scan|Width|Height|Bit'
Format : MPEG-PS
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings : BVOP
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format settings, GOP : M=3, N=12
Bit rate mode : Variable
Bit rate : 24.7 Mb/s
Width : 720 pixels
Height : 576 pixels
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 2.384
Format : PCM
Format settings : Big / Signed
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Bit depth : 16 bits
> mediainfo dv28_25mbps.iso | egrep 'Format|Scan|Width|Height|Bit'
Format : MPEG Video
Format version : Version 2
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings : BVOP
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format settings, GOP : M=3, N=12
Bit rate mode : Variable
Bit rate : 28.0 Mb/s
Width : 720 pixels
Height : 576 pixels
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 2.703
-----------------------------------
That is, suggestion how to merge/customize the newer ffmpeg HDV to
Blu-ray procedure
ffmpeg -i hdv.m2t -c:v copy -c:a pcm_bluray -mpegts_m2ts_mode 1 output.mts
for SD-DV to keep it interlaced and get dv28_25mbps.m2ts muxed directly?
------------------
I did a first try with the following line, without taking care of
25mbps, but got lost the pcm audio to a privat stream (change mode?).
Additional the vido is not kept interlaced.
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12 (SUSE Linux)
..........snip
[dv @ 0x55b59acfeb80] Estimating duration from bitrate, this may be
inaccurate
Input #0, dv, from 'dv28.dv':
Metadata:
timecode : 00:00:00:00
Duration: 00:02:16.64, start: 0.000000, bitrate: 28800 kb/s
Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3],
25000 kb/s, 25 fps, 25 tbr, 25 tbn
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (dvvideo (native) -> mpeg2video (native))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Output #0, mpegts, to 'dv28-mpeg2-SD-bluray.mts':
Metadata:
timecode : 00:00:00:00
encoder : Lavf59.27.100
Stream #0:0: Video: mpeg2video (Main), yuv420p(bottom coded first
(swapped)), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 90k tbn
Metadata:
encoder : Lavc59.37.100 mpeg2video
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[mpegts @ 0x55b59ad3dd40] Stream 1, codec pcm_s16le, is muxed as a
private data stream and may not be recognized upon reading.
frame= 3416 fps=586 q=31.0 Lsize= 39336kB time=00:02:16.64
bitrate=2358.3kbits/s speed=23.4x
video:11070kB audio:25620kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 7.211923%
terje@localhost:/run/media/terje/Seagate_4TB_back/data/Video-test/SD_Blu-ray>
terje@localhost:/run/media/terje/Seagate_4TB_back/data/Video-test/SD_Blu-ray>
ffmpeg -i dv28-mpeg2-SD-bluray.mts 2>&1 >/dev/null | egrep "Video|Audio"
Stream #0:0[0x1011]: Video: mpeg2video (Main) ([2][0][0][0] /
0x0002), yuv420p(tv, progressive), 720x576 [SAR 16:15 DAR 4:3], 25 fps,
25 tbr, 90k tbn
mediainfo dv28-mpeg2-SD-bluray.mts | egrep 'Format|Scan|Width|Height|Bit'
Format : BDAV
Format/Info : Blu-ray Video
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : No
Format settings, Matrix : Default
Format settings, GOP : Variable
Bit rate mode : Variable
Bit rate : 2 257 kb/s
Width : 720 pixels
Height : 576 pixels
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.218
Format : MPEG Video /
---------- Forwarded message ---------
От: Андрей Рандрианасулу <randrik(a)mail.ru>
Date: чт, 24 нояб. 2022 г., 09:33
Subject: unaligned load in bctheme
To: randrianasulu <randrianasulu(a)gmail.com>
so i tried to instrument cingg to see if she does any unaligned access
I added
diff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefile
index 04d5a2e5..b724c668 100644
--- a/cinelerra-5.1/guicast/Makefile
+++ b/cinelerra-5.1/guicast/Makefile
@@ -116,6 +116,7 @@ UTILS = $(OBJDIR)/bootstrap $(OBJDIR)/pngtoh
$(OBJDIR)/pngto
raw
BCXFER = xfer/$(OBJDIR)/xfer.stamp
CFLAGS += $(static_incs)
+CFLAGS += -Wall -fsanitize=alignment
$(shell echo $(CFLAGS) > $(OBJDIR)/c_flags)
$(shell echo $(OBJS) > $(OBJDIR)/objs)
and same -fsanitize=alignment to LDFLAGS env. variable before make.
I got this:
bash-5.1$ /dev/shm/cinelerra/cinelerra-5.1/bin/cin
Cinelerra Infinity - built: Nov 24 2022 08:52:45
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
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.
build plugin index for: /dev/shm/cinelerra/cinelerra-5.1/bin/plugins
PluginFFilter::new_ffilter(overlay_opencl)
err: Input/output error
PluginFFilter::new_ffilter(xfade_opencl)
err: Input/output error
[openclsrc_814 @ 0xb78f400] OpenCL source requires output dimensions to be
specified.
PluginFFilter::new_ffilter(openclsrc)
err: Invalid argument
bctheme.C:458:15: runtime error: load of misaligned address 0x098a364d for
type 'int', which requires 4 byte alignment
0x098a364d: note: pointer points here
45 47 27 00 48 21 00 00 31 30 38 30 74 6f 34 38 30 2e 70 6e 67 00 00 00
00 00 31 30 38 30 74 6f
^
Total excess of backups: -50
Session time: 0:00:07
Cpu time: user: 0:00:03.699 sys: 0:00:00.480
so patch below fixes this error.
Can you please test it on various arches and distros?
diff --git a/cinelerra-5.1/guicast/bctheme.C
b/cinelerra-5.1/guicast/bctheme.C
index 1ec64c7f..9addf9f7 100644
--- a/cinelerra-5.1/guicast/bctheme.C
+++ b/cinelerra-5.1/guicast/bctheme.C
@@ -455,7 +455,10 @@ void BC_Theme::overlay(VFrame *dst, VFrame *src, int
in_x1, int in_x2, int shift
void BC_Theme::set_data(unsigned char *ptr)
{
- int hdr_sz = *(int*)ptr - sizeof(int);
+ //int hdr_sz = *(int*)ptr - sizeof(int);
+ int hdr_sz = 0;
+ memcpy(&hdr_sz, ptr, sizeof(int));
+ hdr_sz -= sizeof(int);
unsigned char *cp = ptr + sizeof(int);
unsigned char *dp = cp + hdr_sz;
int start_item = images.size();
lines 7-28/28 (END)
--
Андрей Рандрианасулу