[Cin] MTS files; concat demuxer / protocol

Stefan de Konink stefan at konink.de
Tue Sep 17 14:11:30 CEST 2024


There are quite some topics online mentioning the when MTS files 
(exceeding 2GB) are naively added to a timeline. The problem that then 
appears is that the audio is typically "shorter" than the video, and it 
does not appear in the interface. Cinelerra will even shift the audio 
track under the previous track.

It is mentioned that Adobe Premiere is able to parse an AVCHD structure, 
including the ability to use meta information such as timecode, which is 
not available from MTS files directly.

Other workarounds that are mentioned to first join the MTS files. FFmpeg 
has the option concat demuxer and concat protocol. But it pulls another 
surprise...


ffmpeg -i "concat:00152.MTS|00153.MTS|00154.MTS" -vcodec copy -acodec 
copy test.ts
ffmpeg version n7.0.1 Copyright (c) 2000-2024 the FFmpeg developers
   built with gcc 14.1.1 (GCC) 20240522
   configuration: --prefix=/usr --disable-debug --disable-static 
--disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm 
--enable-lto --enable-fontconfig --enable-frei0r --enable-gmp 
--enable-gpl --enable-ladspa --enable-libaom --enable-libass 
--enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm 
--enable-libdvdnav --enable-libdvdread --enable-libfreetype 
--enable-libfribidi --enable-libgsm --enable-libharfbuzz 
--enable-libiec61883 --enable-libjack --enable-libjxl 
--enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb 
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt 
--enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e 
--enable-librsvg --enable-librubberband --enable-libsnappy 
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh 
--enable-libsvtav1 --enable-libtheora --enable-libv4l2 
--enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl 
--enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 
--enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg 
--enable-mbedtls --enable-nvdec --enable-nvenc --enable-opencl 
--enable-opengl --enable-shared --enable-vapoursynth --enable-version3 
--enable-vulkan
   libavutil      59.  8.100 / 59.  8.100
   libavcodec     61.  3.100 / 61.  3.100
   libavformat    61.  1.100 / 61.  1.100
   libavdevice    61.  1.100 / 61.  1.100
   libavfilter    10.  1.100 / 10.  1.100
   libswscale      8.  1.100 /  8.  1.100
   libswresample   5.  1.100 /  5.  1.100
   libpostproc    58.  1.100 / 58.  1.100
Input #0, mpegts, from 'concat:00152.MTS|00153.MTS|00154.MTS':
   Duration: 00:25:04.36, start: 1.040000, bitrate: 24022 kb/s
   Program 1
   Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), 
yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn
   Stream #0:1[0x1100]: Audio: pcm_bluray (HDMV / 0x564D4448), 48000 Hz, 
stereo, s16, 1536 kb/s
   Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle (pgssub) 
([144][0][0][0] / 0x0090), 1920x1080
File 'test.ts' already exists. Overwrite? [y/N] y
Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
Output #0, mpegts, to 'test.ts':
   Metadata:
     encoder         : Lavf61.1.100
   Stream #0:0: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(top 
first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn
   Stream #0:1: Audio: pcm_bluray (HDMV / 0x564D4448), 48000 Hz, stereo, 
s16, 1536 kb/s
Press [q] to stop, [?] for help
[mpegts @ 0x600ed54cf540] Stream 1, codec pcm_bluray, is muxed as a 
private data stream and may not be recognized upon reading.

This results in a video file cinelerra (and others) cannot read.

Instead if we would say do it in pcm_sb16le we would be able to show 
that the MTS file does contain the audio and FFmpeg is able to read it. 
I have attached a screenshot showing what happens.

I wonder: could we in Cinelerra implement something that would not open 
a file as single file or EDL, but instead a concat set of files?

Something in the drop down: "Create a single new resource only". That 
single resource should be opened via the concat protocol, and then be 
able as single instance. An EDL, but then at protocol level.

I think this would make sense for many recordings that are split due to 
filesystem limits, but even for image sequences, if they could be 
directly opened and edited as if they were single files.

-- 
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mts.png
Type: image/png
Size: 277787 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240917/232e430e/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xDA0A21EE7E3D2959.asc
Type: application/pgp-keys
Size: 3074 bytes
Desc: OpenPGP public key
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240917/232e430e/attachment-0001.skr>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240917/232e430e/attachment-0001.asc>


More information about the Cin mailing list