tubesync
tubesync copied to clipboard
Split by chapters
Enable the --split-chapter options to split the videos into multiple videos
I don't believe --split-chapter
is available over the embedded yt-dlp
API at the moment so this suggestion may be difficult to evaluate.
Ah which package are you using? Because it is available in the official yt-dlp
binary
The general yt-dlp
package, but using the embedded API not CLI flags. I can't see any available options for chapter splitting here: https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L191
The general
yt-dlp
package, but using the embedded API not CLI flags. I can't see any available options for chapter splitting here: https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L191
Any updates on this? I see there is a new major version of yt-dlp out https://pypi.org/project/yt-dlp/ Does the api have support for chapters with this and if not could tubesync be changed to use the cli version instead if that is what is getting updated/supported more regularly?
Last I looked into this it might be possible with some filters and not via the direct API args. It's still not in the main API in the latest yt-dlp releases. I've been spending my time on some other issues. I'll get around to this eventually, but it might be a while. I'm happy to accept PRs for features if it's a feature you want to have sooner though.
Last I looked into this it might be possible with some filters and not via the direct API args. It's still not in the main API in the latest yt-dlp releases. I've been spending my time on some other issues. I'll get around to this eventually, but it might be a while. I'm happy to accept PRs for features if it's a feature you want to have sooner though.
Not sure what the OP was trying to do, but I really wanted support for chapters within the final mkv file. I did some experimenting and was able to modify sync\youtube.py with the following to enable chapters I tested this and it works. I am trying to also add sponsorblock, but haven't verified if that's working yet.
sync\youtube.py changes at line 94
opts = get_yt_opts()
opts.update({
'format': media_format,
'merge_output_format': extension,
'outtmpl': output_file,
'quiet': True,
'progress_hooks': [hook],
'writeinfojson': info_json,
'sponsorblock_remove': True,
'postprocessors': [{
# Embed metadata in video using ffmpeg.
'key': 'FFmpegMetadata',
'add_chapters': True,
'add_metadata': True
}, {
# --sponsorblock-remove all
'key': 'SponsorBlock',
'categories': 'all',
'api': 'https://sponsor.ajay.app',
'when': 'after_filter'
}, {
'key': 'FFmpegSubtitlesConvertor',
'format': 'srt'
}, {
'key': 'FFmpegThumbnailsConvertor',
'format': 'jpg',
# Run this before the actual video download
'when': 'before_dl'
}, {
'key': 'EmbedThumbnail',
'already_have_thumbnail': True
}, {
'key': 'FFmpegEmbedSubtitle'
}
]
})
Awesome, thanks! I've not tested this since my original comment but if this works for you now I'm very happy to merge these changes in. If you can confirm sponsorblock works or not as well feel free to submit a PR, or if you prefer I can just make the changes manually. Thanks for the contribution.
Awesome, thanks! I've not tested this since my original comment but if this works for you now I'm very happy to merge these changes in. If you can confirm sponsorblock works or not as well feel free to submit a PR, or if you prefer I can just make the changes manually. Thanks for the contribution.
I haven't gotten the sponsorblock to work, but here is the original code where i got chapters working without sponsorblock this should be good to commit.
opts = get_yt_opts()
opts.update({
'format': media_format,
'merge_output_format': extension,
'outtmpl': output_file,
'quiet': True,
'progress_hooks': [hook],
'writeinfojson': info_json,
'postprocessors': [{
# Embed metadata in video using ffmpeg.
'key': 'FFmpegMetadata',
'add_chapters': True,
'add_metadata': True,
}, {
'key': 'FFmpegSubtitlesConvertor',
'format': 'srt'
}, {
'key': 'FFmpegThumbnailsConvertor',
'format': 'jpg',
# Run this before the actual video download
'when': 'before_dl'
}, {
'key': 'EmbedThumbnail',
'already_have_thumbnail': True
}, {
'key': 'FFmpegEmbedSubtitle'
}
]
})
Nice, thanks. I'll pop this into the next release after some testing. Thanks for the contribution.
I think I managed to get YoutubeDL.py to do splitting chapters. I asked a question in MeTube Github and got some help.
Using this made it work
{"postprocessors": [{"key": "FFmpegSplitChapters"}]}
Thanks! That's a useful filter to know about. This would still require quite some effort as I'd need to track all the downloaded files rather than one file per media item, but I'll certainly look into it as a feature if I get time.