View Issue Details

IDProjectCategoryView StatusLast Update
0000659Cinelerra-GG[All Projects] Featurepublic2024-06-09 21:02
ReporterKabak Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000659: Long record with splitted MTS files
DescriptionDue to FAT16/FAT32 limitation, camera using MTS files split it into chunks during long record.

MTS files use frames for audio and video. On some camera, a frame can be divided between the two files. Cinelerra cannot recover this lost frame even if it have all data.

A function to virtually join those chunks from a long record will be helpful.
Steps To ReproduceUse some video camera with AVCHD/MTS output (my case, panasonic camera)

Make a long record to have 2 or 4Gb file.
Try to assemble those files without and with a concatenation (using command lines from OS).
Additional InformationVersion : 20240229
TagsNo tags attached.

Activities

Kabak

Kabak

2024-06-09 21:02

reporter   ~0005652

The ffmpeg concat not seem to work.

First track : Raw file
Second track : files concatenated with linux "cat" or "fuse" command
Third track : tried the "ffmpeg -i "concat:input1.ts|input2.ts|input3.ts" -c copy output.ts" command pattern but it seem to have some issue :
- videos and audio are synced at the joint
- video concatenated with ffmpeg at the end seem to have more frame
- audio concatenated with ffmpeg is not synced at the start

Using FUSE (like concatFS does) seem's to be the best way. It create a virtual file (no need to use disk space) and it can be used like an normal video file (already tested).


To determine file which needed to be joined, i extract tags with the command ' ffprobe -loglevel 0 -print_format json -show_streams -show_streams "file.mts" ' (in the .txt)

We can see the "start_time" is different between files so we can easily determine if two consecutive filename is from the same "shot" or not. (can be extracted with ' ffprobe -loglevel quiet -select_streams 0 -show_entries stream=start_time -i "01150.MTS" ' )

ffprobe tags.txt (6,431 bytes)
ffprobe -loglevel 0 -print_format json -show_streams  -show_streams "01150.MTS"
{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_tag_string": "HDMV",
            "codec_tag": "0x564d4448",
            "width": 1920,
            "height": 1080,
            "coded_width": 1920,
            "coded_height": 1080,
            "closed_captions": 0,
            "film_grain": 0,
            "has_b_frames": 1,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuv420p",
            "level": 40,
            "chroma_location": "left",
            "field_order": "tt",
            "refs": 1,
            "is_avc": "false",
            "nal_length_size": "0",
            "id": "0x1011",
            "r_frame_rate": "50/1",
            "avg_frame_rate": "25/1",
            "time_base": "1/90000",
            "start_pts": 84600,
            "start_time": "0.940000",
            "duration_ts": 62195400,
            "duration": "691.060000",
            "bits_per_raw_sample": "8",
            "extradata_size": 97,
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            }
        },
        {
            "index": 1,
            "codec_name": "ac3",
            "codec_long_name": "ATSC A/52A (AC-3)",
            "codec_type": "audio",
            "codec_tag_string": "AC-3",
            "codec_tag": "0x332d4341",
            "sample_fmt": "fltp",
            "sample_rate": "48000",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "id": "0x1100",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/90000",
            "start_pts": 77400,
            "start_time": "0.860000",
            "duration_ts": 62205120,
            "duration": "691.168000",
            "bit_rate": "256000",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            }
        }
    ]
}




ffprobe -loglevel 0 -print_format json -show_streams  -show_streams "01151.MTS"
{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_tag_string": "HDMV",
            "codec_tag": "0x564d4448",
            "width": 1920,
            "height": 1080,
            "coded_width": 1920,
            "coded_height": 1080,
            "closed_captions": 0,
            "film_grain": 0,
            "has_b_frames": 1,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuv420p",
            "level": 40,
            "chroma_location": "left",
            "field_order": "tt",
            "refs": 1,
            "is_avc": "false",
            "nal_length_size": "0",
            "id": "0x1011",
            "r_frame_rate": "50/1",
            "avg_frame_rate": "25/1",
            "time_base": "1/90000",
            "start_pts": 62292600,
            "start_time": "692.140000",
            "duration_ts": 5862600,
            "duration": "65.140000",
            "bits_per_raw_sample": "8",
            "extradata_size": 97,
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            }
        },
        {
            "index": 1,
            "codec_name": "ac3",
            "codec_long_name": "ATSC A/52A (AC-3)",
            "codec_type": "audio",
            "codec_tag_string": "AC-3",
            "codec_tag": "0x332d4341",
            "sample_fmt": "fltp",
            "sample_rate": "48000",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "id": "0x1100",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/90000",
            "start_pts": 62282520,
            "start_time": "692.028000",
            "duration_ts": 5878080,
            "duration": "65.312000",
            "bit_rate": "256000",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            }
        }
    ]
}

ffprobe tags.txt (6,431 bytes)
MTS concat with ffmpeg 1.png (669,546 bytes)
MTS concat with ffmpeg 3.png (436,651 bytes)
Andrew-R

Andrew-R

2024-05-30 23:36

reporter   ~0005644

well, I think I saw quite a lot of splitted hairs on ffmpeg-user when concatenation of two files for some reason go wrong ... So I am not sure this specific request easy to handle ...

@Kabak
Does ffmpeg (command line) works for your cases?
Kabak

Kabak

2024-05-16 19:29

reporter   ~0005635

An possible option : make an assistant in order to create a virtual file with fuse and load it ( example : https://github.com/schlaile/concatfs )
Kabak

Kabak

2024-05-14 21:53

reporter  

MTS concat needed 2.png (264,571 bytes)

Issue History

Date Modified Username Field Change
2024-05-14 21:53 Kabak New Issue
2024-05-14 21:53 Kabak File Added: MTS concat needed 2.png
2024-05-16 19:29 Kabak Note Added: 0005635
2024-05-30 23:36 Andrew-R Note Added: 0005644
2024-06-09 21:02 Kabak File Added: MTS concat with ffmpeg 1.png
2024-06-09 21:02 Kabak File Added: MTS concat with ffmpeg 2.png
2024-06-09 21:02 Kabak File Added: MTS concat with ffmpeg 3.png
2024-06-09 21:02 Kabak File Added: ffprobe tags.txt
2024-06-09 21:02 Kabak Note Added: 0005652