lisamelton / other_video_transcoding

Other tools to transcode videos.
MIT License
550 stars 25 forks source link

--add-subtitle all? #3

Closed rcarmo closed 4 years ago

rcarmo commented 4 years ago

I'm experimenting with this in order to build an automated transcoding container like this one, and was wondering if copying across all subtitles would be possible.

A possible limitation of this would be that some formats can't be embedded in some envelopes (like MP4, which is my target), so there would have to be extra error handling.

lisamelton commented 4 years ago

@rcarmo My apologies for taking so long to respond but I was on a road trip today.

I'm not sure how your feature request is related to building containers, but... :)

Currently there is no way to add either all audio tracks or all subtitle tracks from an input source with a single option and argument. My older transcode-video tool has this feature but I intentionally left it out of other-transcode in the hope that users would add tracks by by language or title instead because this would 1) make those users more thoughtful and 2) yield smaller output.

And during private beta testing with more than a dozen users since April when I started development on other-transcode, no one has made a similar feature request.

But, hey, social engineering doesn't always work. :) So I will consider adding a feature like this in the future.

Also, my code already doesn't allow adding image-based subtitles to MP4 output.

lisamelton commented 4 years ago

@rcarmo BTW, let me know if you do build that automated transcoding container and it's publicly available somewhere. I'm sure others would find that useful, too. Thanks!

rhapsodians commented 4 years ago

@rcarmo I'm curious to know more about the use case for this request. When I rip BRs, limiting the language to one's native language(s) is usually sufficient and Don provides this with the language feature. It's also easy to specify multiple languages for both audio and subtitles.

But if you ignore 1) forced subtitles (which is a separate feature) and 2) deliberately choosing a non-native language title (like using Mandarin as the default language in Crouching Tiger, Hidden Dragon with English subtitles because IMHO it's a better movie that way), why would you want to add 10-15? possible other languages/subtitles? (We all have BRs with multiple languages included). Just curious as it's something I hadn't thought of as a requirement until you requested it.

Thanks, Joe

rcarmo commented 4 years ago

It’s nearly done - I’ll be setting up Travis CI in a few hours, just testing the defaults to my liking.

On 1 Jan 2020, at 22:39, Don Melton notifications@github.com wrote:

 @rcarmo BTW, let me know if you do build that automated transcoding container and it's publicly available somewhere. I'm sure others would find that useful, too. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

rcarmo commented 4 years ago

@rhapsodians well, the original reason I actually asked for this is that the script (actually, ffmpeg itself) currently errors out if I ask for a subtitle language that isn’t actually present.

Since I am currently batch reconverting older files to HEVC/MP4 on a couple of Linux boxes, I can easily remux and strip out the subtitles I don’t need using Subler after they have been batch processed, which I usually do on a much less powerful Mac (I also add metadata to them in that step).

However, I should point out that I have a multilingual household in some respects (my kids used to rely on Portuguese subtitles, but now prefer to watch movies with English subtitles on occasion to better understand the dialogue, and I also keep English subtitles for the hearing impaired - it is useful when watching movies late at night with the sound turned way down).

lisamelton commented 4 years ago

@rcarmo I'm not seeing that error, i.e. ffmpeg failing when calling other-transcode to add a audio or subtitle in a language that either does not exist within the input file or is an invalid ISO 639-2 language code. My code is designed to ignore both of those cases.

Can you show me the command line you're using and the console error output you're seeing? Thanks.

Also, I'm not sure how needing English and Portuguese subtitles is a reason to implement a feature that adds all subtitles from the input. That could be easily done by using --add-subtitle eng --add-subtitle por to your command line, plus it's more restrictive.

rcarmo commented 4 years ago

When I added that exact setting (--add-subtitle eng --add-subtitle por) the script fails when there are no English subtitles. I am on my iPad now, but will report back.

rhapsodians commented 4 years ago

@rcarmo thanks for the info ... but like @donmelton said, I also haven't seen errors when using other-transcode with audio/subtitles which don't exist or using invalid language codes so I think it would be useful to dig into why you're seeing this and provide the commandline or console error as Don suggested to help diagnose it.

Also, I totally get why having multiple language (audio and subtitle) is useful - I use it myself on occasion trying to improve my French! But it's simple to do what you need in other-transcode by adding both language arguments for both audio and subtitle streams ... Don specifically included these from early in development in addition to adding in stream title matching too (so if you have a audio or subtitle streams called "Director's Commentary", you can add it by --add-audio "commentary" --add-subtitle "commentary" etc.

rhapsodians commented 4 years ago

@rcarmo And a word of advice (which Don mentioned too earlier) ... be careful when using MP4/M4V as opposed to MKV. You can't use it as a container for PGS (image-based subtitles) and why MKV is the default. If you use MP4 but need subtitles, adding .srt text-based subs via something like Plex is the best route. You would have Movie (YYYY).mp4, Movie (YYYY).en.srt and Movie (YYYY).pt.srt in the same folder. Alternatively, playback directly on a iOS device, something like Infuse Pro will work well with subtitles too.

rcarmo commented 4 years ago

Hi again,

I've been weirdly unable to reproduce the problems I had yesterday. Regardless, the sources to build container I mentioned are now public, so whatever I end up coming across, it'll be reproducible :)

lisamelton commented 4 years ago

@rcarmo Thanks for the link! I'll check it out.

lisamelton commented 4 years ago

@rcarmo One note on your project page, my first name is "Don" and not "Dan". I would appreciate you fixing that.

rcarmo commented 4 years ago

Oh, apologies. I created the repo on my iPad, must have been autocorrect...

lisamelton commented 4 years ago

@rcarmo Thanks for the quick fix!

One question, does your Docker container still allow access to hardware encoders? Normally running in a container can be problematic that way.

rcarmo commented 4 years ago

Yes, it does. There is a note to that effect at the bottom of the README, but essentially I've already confirmed that both Quick Sync and vaapi work with the hardware I have at home (Intel integrated graphics and a Synology NAS).

I do ML work with NVIDIA GPUs, but I don't have that kind of hardware with me (and haven't had the time to spin up a suitable VM). But nvenc and the like should also work fine - I'll update the README with any additional notes.

lisamelton commented 4 years ago

@rcarmo I've checked in an implementation of your feature request here: https://github.com/donmelton/other_video_transcoding/commit/cf043c4a2d9b51e8e944027476e70550fa8e7b65

I'll let you know when it's released.

lisamelton commented 4 years ago

@rcarmo OK, I released this yesterday. Just gem update to get the new version. Closing this now. Thanks again for filing this issue!

rcarmo commented 4 years ago

Thanks, will test ASAP

On 14 Jan 2020, at 17:11, Don Melton notifications@github.com wrote:

 @rcarmo OK, I released this yesterday. Just gem update to get the new version. Closing this now. Thanks again for filing this issue!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.