mifi / lossless-cut

The swiss army knife of lossless video/audio editing
https://losslesscut.app/
GNU General Public License v2.0
28.11k stars 1.36k forks source link

Blackmagic BRAW support #1637

Closed WangleLine closed 1 year ago

WangleLine commented 1 year ago

I have a lot of issues to go through, so in order to make it easier for me to help you, I ask that you please try these things first

Description

I use blackmagic cameras that create .Braw (Blackmagic Raw) files. It would be nice to be able to trim them in Lossless Cut

https://documents.blackmagicdesign.com/DeveloperManuals/BlackmagicRAW-SDK.pdf

mifi commented 1 year ago

What's the error you're getting?

WangleLine commented 1 year ago

I'm not getting an error message, as far as I can tell, but Lossless Cut detects it as mov/quicktime and then doesn't display any of the videos' frames:

LosslessCut_tclwpLG6s2

mifi commented 1 year ago

Ok I managed to download a BRAW file from the internet. Here's my findings:

ffmpeg output:

ffmpeg -i Filmplusgear-skiers-Ischgl-2019-HD.braw

ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.2_6 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x157e04650] Skipping unhandled metadata tone_curve_video_black_level of type 76
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x157e04650] Skipping unhandled metadata viewing_bmdgen of type 76
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x157e04650] Skipping unhandled metadata crop_origin of type 71
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x157e04650] Skipping unhandled metadata crop_size of type 71
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x157e04650] Skipping unhandled metadata braw_codec_bitrate of type 77
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x157e04650] Could not find codec parameters for stream 0 (Video: none (brvl / 0x6C767262), none, 1952x1096, 296983 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Filmplusgear-skiers-Ischgl-2019-HD.braw':
  Metadata:
    creation_time   : 2019-03-07T12:42:25.000000Z
    camera_type     : Blackmagic Pocket Cinema Camera 4K
    tone_curve_contrast: 1.000000
    tone_curve_saturation: 1.000000
    tone_curve_midpoint: 0.409008
    tone_curve_highlights: 1.000000
    tone_curve_shadows: 1.000000
    viewing_gamut   : Blackmagic Design
    braw_compression_ratio: Q0
    manufacturer    : Blackmagic Design
    camera_id       : 7c5e7f32-6a65-40c2-aa46-eb39317defc3
    shutter_type    : Speed
    analog_gain     : 1.000000
    viewing_gamma   : Blackmagic Design Film
    aspect_ratio    : 2.40:1
    firmware_version: 6.2
    clip_number     : A002_03071342_C014
    reel_name       : 2
    scene           : 1
    take            : 86
    good_take       : false
    environment     : interior
    day_night       : day
    camera_number   : A
    date_recorded   : 2019:03:07
  Duration: 00:00:13.60, start: 0.000000, bitrate: 299713 kb/s
  Stream #0:0[0x1](eng): Video: none (brvl / 0x6C767262), none, 1952x1096, 296983 kb/s, 25 fps, 25 tbr, 25 tbn (default)
    Metadata:
      creation_time   : 2019-03-07T12:42:25.000000Z
      handler_name    : ?Apple Video Media Handler
      vendor_id       : [0][0][0][0]
      timecode        : 13:42:25:14
  Stream #0:1[0x2](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2019-03-07T12:42:25.000000Z
      handler_name    : ?Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
      timecode        : 13:42:25:14
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2019-03-07T12:42:25.000000Z
      handler_name    : Time Code Media Handler
      timecode        : 13:42:25:14
At least one output file must be specified

ffprobe:

ffprobe -of json -show_format -show_streams -i Filmplusgear-skiers-Ischgl-2019-HD.braw

{
    "streams": [
        {
            "index": 0,
            "codec_type": "video",
            "codec_tag_string": "brvl",
            "codec_tag": "0x6c767262",
            "width": 1952,
            "height": 1096,
            "has_b_frames": 0,
            "level": -99,
            "id": "0x1",
            "r_frame_rate": "25/1",
            "avg_frame_rate": "25/1",
            "time_base": "1/25",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 340,
            "duration": "13.600000",
            "bit_rate": "296983792",
            "nb_frames": "340",
            "disposition": {
                "default": 1,
                "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
            },
            "tags": {
                "creation_time": "2019-03-07T12:42:25.000000Z",
                "language": "eng",
                "handler_name": "\u0019Apple Video Media Handler",
                "vendor_id": "[0][0][0][0]",
                "timecode": "13:42:25:14"
            }
        },
        {
            "index": 1,
            "codec_name": "pcm_s24le",
            "codec_long_name": "PCM signed 24-bit little-endian",
            "codec_type": "audio",
            "codec_tag_string": "in24",
            "codec_tag": "0x34326e69",
            "sample_fmt": "s32",
            "sample_rate": "48000",
            "channels": 2,
            "bits_per_sample": 24,
            "id": "0x2",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/48000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 652800,
            "duration": "13.600000",
            "bit_rate": "2304000",
            "bits_per_raw_sample": "24",
            "nb_frames": "652800",
            "disposition": {
                "default": 1,
                "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
            },
            "tags": {
                "creation_time": "2019-03-07T12:42:25.000000Z",
                "language": "eng",
                "handler_name": "\u0019Apple Sound Media Handler",
                "vendor_id": "[0][0][0][0]",
                "timecode": "13:42:25:14"
            }
        },
        {
            "index": 2,
            "codec_type": "data",
            "codec_tag_string": "tmcd",
            "codec_tag": "0x64636d74",
            "id": "0x3",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "25/1",
            "time_base": "1/25",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 340,
            "duration": "13.600000",
            "bit_rate": "2",
            "nb_frames": "1",
            "extradata_size": 18,
            "disposition": {
                "default": 1,
                "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
            },
            "tags": {
                "creation_time": "2019-03-07T12:42:25.000000Z",
                "language": "eng",
                "handler_name": "Time Code Media Handler",
                "timecode": "13:42:25:14"
            }
        }
    ],
    "format": {
        "filename": "Filmplusgear-skiers-Ischgl-2019-HD.braw",
        "nb_streams": 3,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "13.600000",
        "size": "509513276",
        "bit_rate": "299713691",
        "probe_score": 100,
        "tags": {
            "creation_time": "2019-03-07T12:42:25.000000Z",
            "camera_type": "Blackmagic Pocket Cinema Camera 4K",
            "tone_curve_contrast": "1.000000",
            "tone_curve_saturation": "1.000000",
            "tone_curve_midpoint": "0.409008",
            "tone_curve_highlights": "1.000000",
            "tone_curve_shadows": "1.000000",
            "viewing_gamut": "Blackmagic Design",
            "braw_compression_ratio": "Q0",
            "manufacturer": "Blackmagic Design",
            "camera_id": "7c5e7f32-6a65-40c2-aa46-eb39317defc3",
            "shutter_type": "Speed",
            "analog_gain": "1.000000",
            "viewing_gamma": "Blackmagic Design Film",
            "aspect_ratio": "2.40:1",
            "firmware_version": "6.2",
            "clip_number": "A002_03071342_C014",
            "reel_name": "2",
            "scene": "1",
            "take": "86",
            "good_take": "false",
            "environment": "interior",
            "day_night": "day",
            "camera_number": "A",
            "date_recorded": "2019:03:07"
        }
    }
}

Because there doesn't seem to exist any open source code or ffmpeg discussions around supporting this format, and no video players support it, I think it's not going to be feasible to add it to losslesscut, closing for now.