Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to download video while keeping their chapters metadata? [closed]

I've used many video downloaders before: atube catcher, 4k downloader, jDownloader, and currently using youtube-dl. I can't download videos, this for example, while still keeping their online chapters intact, like part1 is "intro" lasting from 00:00 to 00:45 and so on. So far I tried these parameters with youtube-dl

Filesystem

--write-annotations --write-description --write-info-json

Thumbnail images

--write-all-thumbnails

Video format

-f 'bestvideo[height<=720]+bestaudio/best[height<=720]/worst' --merge-output-format mp4

Post-processing

--add-metadata --embed-subs --embed-thumbnail


Also tried requesting the mkv video format (thought maybe it was built into it) didn't help tho.
I know these options don't really say anything about sections but I'm trying to get as much metadata as I can
like image 597
Mohammad AbouElSherbini Avatar asked Aug 15 '20 03:08

Mohammad AbouElSherbini


People also ask

Why did YouTube remove chapters?

Another reason why your YouTube chapters aren't working is because your channel doesn't have enough subscribers. Your channel needs at least 1,000 subscribers before you can add YouTube chapters.

How do I download a chapter from YouTube?

Youtube recently enabled the option to add chapters in YouTube videos. This is done by simply adding the chapter timestamps (start time) in the description of the video.

What is video metadata and why does it matter?

It’s attached to the file and can include copyright information, author, keywords, file size, media format, people, place, closed captioning and subtitling information, and lots more. Whenever you copy, email, or publish your file, all its file information or metadata travels along with it. There are two types of video metadata:

How do I keep metadata from changing in my review platform?

The best way to ensure you're not changing the metadata of the data you collect is to "containerize" it. This is done by putting data into a container, such as a ZIP file or a PST, which you can copy and move without affecting the data you see in your review platform.

What happens to my metadata when I move a file?

If you move a file, it doesn’t change these fields. The best way to ensure you're not changing the metadata of the data you collect is to "containerize" it. This is done by putting data into a container, such as a ZIP file or a PST, which you can copy and move without affecting the data you see in your review platform.

How do I find metadata on videos uploaded to YouTube?

Metadata on videos uploaded to YouTube 1 Navigate to the YouTube video you want to find metadata for. 2 Underneath the video screen, there are some basic metadata, such as the title, uploader and date uploaded. 3 To dig deeper, right-click next to the video player and select “View page info.” This will provide you with further... More ...


1 Answers

The information you want is called chapters in the youtube-dl info JSON.

There is a recent open pull request for youtube-dl that fixes a problem with this information. In the current release of youtube-dl, if you use the ---write-info-json or --dump-json you will see that the chapters information is null ("chapters": null). You can use the code in the fork repository to be able to obtain the information you want.

Follow these steps:

  1. Clone this repository:

    git clone https://github.com/gschizas/youtube-dl.git
    
  2. Change to the repository directory:

    cd youtube-dl/
    
  3. Checkout the pull request branch:

    git checkout bugfix/youtube/chapters-fix-extractor
    
  4. Run youtube-dl from the current location:

    python -m youtube_dl --write-info-json https://youtu.be/LnO42jxJaC4
    

You will see information like this in the info JSON:

"chapters": [
    {
        "start_time": 0.0,
        "end_time": 46.0,
        "title": "Intro"
    },
    {
        "start_time": 46.0,
        "end_time": 72.0,
        "title": "QOTD"
    },
    ...
]

Hopefully the fix will be accepted into the youtube-dl repository and included in future releases, so there will be no need to clone any repository.

like image 179
Hernán Alarcón Avatar answered Oct 03 '22 08:10

Hernán Alarcón