Kethsar / ytarchive

Garbage Youtube livestream downloader
MIT License
1.18k stars 93 forks source link

added --mkv switch to mux to mkv-files instead of mp4 #42

Closed ghost closed 3 years ago

ghost commented 3 years ago

solves https://github.com/Kethsar/ytarchive/issues/20

Kethsar commented 3 years ago

Have you tested this in various combinations with other flags, particularly --add-metadata and -t? Metadata might be fine, but I am not sure off hand if the hacky way I add thumbnails will work with mkv. It might be mp4 specific.

ghost commented 3 years ago

I've modified it to work with mkv metadata/thumbnails

Output from a livestream with yt-dlp (with --add-metadata and --embed-thumbnail)

Input #0, matroska,webm, from 'Livestream Hervormde Gemeente de Bron Urk 2021-10-01 17_15 [RW7upqdlu3E].mkv':
  Metadata:
    title           : Livestream Hervormde Gemeente de Bron Urk 2021-10-01 17:15
    PURL            : https://www.youtube.com/watch?v=RW7upqdlu3E
    COMMENT         : https://www.youtube.com/watch?v=RW7upqdlu3E
    ARTIST          : Hervormde Gemeente de Bron Urk
    DATE            : 20211001
    ENCODER         : Lavf58.29.100
  Duration: 00:00:45.00, start: 0.000000, bitrate: 362 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Metadata:
      DURATION        : 00:00:44.978000000
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:00:44.996000000
    Stream #0:2: Video: png, rgb24(pc), 1280x720, 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      filename        : cover.png
      mimetype        : image/png

Output from ytarchive.py

IInput #0, matroska,webm, from 'Livestream Hervormde Gemeente de Bron Urk-RW7upqdlu3E.mkv':
  Metadata:
    title           : Livestream Hervormde Gemeente de Bron Urk
    COMMENT         : https://www.youtube.com/watch?v=RW7upqdlu3E
                    : 
                    : 
    COMPATIBLE_BRANDS: iso6mp41
    MAJOR_BRAND     : dash
    MINOR_VERSION   : 0
    ARTIST          : Hervormde Gemeente de Bron Urk
    DATE            : 20211001
    ENCODER         : Lavf58.29.100
  Duration: 00:04:45.23, start: 0.000000, bitrate: 522 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Metadata:
      HANDLER_NAME    : ISO Media file produced by Google Inc. Created on: 10/01/2021.
      DURATION        : 00:03:55.235000000
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
    Metadata:
      HANDLER_NAME    : ISO Media file produced by Google Inc. Created on: 10/01/2021.
      DURATION        : 00:04:45.234000000
    Stream #0:2: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      filename        : Livestream Hervormde Gemeente de Bron Urk-RW7upqdlu3E.jpg
      mimetype        : image/jpeg
Kethsar commented 3 years ago

I'll give this a test later today after wark before merging. Thanks.

Kethsar commented 3 years ago

Welp, seems Windows explorer doesn't support the mkv thumbnail attachment, but at least I found the docs about it so it's technically correct.

ghost commented 3 years ago

The thumbnail filename is now cover_land.jpg