Felmachersoft / StreamBuffRe

Public issue tracker for StreamBuffRe, see https://streambuffre.com/
5 stars 0 forks source link

Add support for custom qualities #39

Closed P1st0nBr0ke closed 2 years ago

P1st0nBr0ke commented 2 years ago

I'm currently only testing the free version of StreamBuffRe so, am I correct to assume in the paid-for version that if two instances of the same URL are loaded - one for the video and original audio track, and the other for the audio track in your language of choice - and then the multiselection option is deployed to play/download both chosen streams, they'll play or download as separate instances rather than achieving one stream with the option to choose one of two audio tracks?

At present, I have to download separate instances and then remux so, if it were possible, it would be a useful feature.

Probably going to go for the paid version anyway because it's a nice GUI for youtube-dl (and maybe yt-dlp at some point?).

Thanks

Felmachersoft commented 2 years ago

Yes, a full license allows you to use multiple players parallel playing the same or different streams. However, the players won't be synced to each other. To be honest I was not aware, that there are youtube videos with multiple audio tracks. Please Provide an example so I can check what can be done and how it can be implemented. In theory video and audio tracks from different sources can be mixed as well, it hasn't been implemented as I saw no use case so far.

StreamBuffRe is no youtube-dl GUI. It uses youtube-dl (since some versions it actually uses youtube-dlp instead of youtube-dl) only to get the direct stream URL. Everything else from buffering to downloading and playing is done by StreamBuffRe itself. You can also write your own resolver using ScChrom instead of using youtube-dl(p).

P1st0nBr0ke commented 2 years ago

Thank you for your response and info.

Sorry for not being clear - I wasn't referring to Youtube. I was requesting the feature (if it's possible) for online streams from online live TV channels and On Demand services.

As an example - TV channel RTBF Auvio. It's a Belgium channel so a proxy as well as a free account is required. They tend to live stream with either a French commentary track or just an ambient noise as default, but the original English track is there and can be selected in browser. Usually all but the French commentary is removed in the player once the video is archived for On Demand purposes. All video and audio HLS streams remain in place on the back-end and can be retrieved with youtube-dl/yt-dlp.

Please see an example of an On Demand video they didn't remove the English 'Version originale' audio track from: https://www.rtbf.be/auvio/detail_moto-gp-gp-italie?id=2902171

Apologies for likening StreamBuffRe to a youtube-dl GUI. As you've said, the software deploys youtube-dl to gather stream information. That process happens without the user needing to fire up a Command Prompt shell, which is what I meant - admittedly, narrated clumsily.

Felmachersoft commented 2 years ago

When activating the option "show all qualities" at the quality control I found the two separate audio streams (French and multi-language). However, I failed to download them via StreamBuffRe so far, due to 403 errors while downloading the necessary key files. The reason is most likely caused by missing account data.

My questions:

  1. Did you download the streams via StreamBuffRe or another program? If you used StreamBuffRe or youtube-dl, did you forward account data or cookies? If so can you tell me how you did it so I can test it directly with the correct stream.

  2. I'm still not sure what exactly you need. Do you need a way to a) mix two or more sound streams into a single video file on the fly (one video with multiple sound streams) or b) create custom qualities allowing to freely mix any video with any sound stream (one video with one sound stream) ?

P1st0nBr0ke commented 2 years ago

That sounds like a common youtube-dl error. If you run youtube-dl from CMD, try flushing the cache using "youtube-dl --rm-cache-dir" (no quotes) and then try again.

I'm able to download all streams with StreamBuffRe, youtube-dl and yt-dlp by simply entering the video's URL (not stream info). Proxy needed, but I'm assuming you already deployed one to get a list of available streams.

No, not looking to mix two audio streams on the fly. I can achieve that using youtube-dl. The problem is, when I've previously done so, the default French audio track and the required English track just get merged, but that quite possibly is due to my lack of knowledge.

Ideally, looking for the English 'Version originale' audio track to be either the default track when loaded or to make it selectable in the StreamBuffRe player of choice, as indeed it is when viewed via browser on the RTBF Auvio site.

The frustrating thing is, I know for a fact the original streams are supplied with the required, English commentary audio track.

Felmachersoft commented 2 years ago

After switching through some proxies I got it to work as well. And doing so I found out, that the stream is rather strange: It's not youtube-dl that merges two audio tracks for you, the stream itself (quality name 720p - 128 kb/s) has them merged in it (mpv detects them as one single track). I have no idea how their web player splits them into two different ones, but it's not standard behavior. For the other pure sound streams (hls-aduio-aacl-128-French, which is no comment and hls-aduio-aacl-128-Multiple_languages, which is English only) they work flawlessly.

I add creation of custom qualities and check how it works so that you can mix video with your preferred sound stream. That should fix that.

P1st0nBr0ke commented 2 years ago

Yes, there doesn't appear to be a separate video only track, so it's a bit of a head scratcher. The default audio is always either French or ambient noise only, hence why adding the string "-f hls-2256+hls-audio-aacl-128-Multiple_languages" to a yt-dl command line produces the desired 720P video track with the default, unwanted, French or ambient track AND the desired English commentary merged together.

As you say,, all works wonderfully in browser, so I was wondering if, somehow, RTBF's web player actually mutes/ignores the default, unwanted audio track when an alternative track is selected.

As an aside, I cannot believe no one has asked you to look in to this feature before now- it's a common problem - just not on Youtube, currently. But watching TV live and on demand via the web is certainly the way things are going, so the feature, if it's possible to add, would be invaluable, IMO.

Felmachersoft commented 2 years ago

The stream is no longer available. Can you provide a new one that lasts at least over the weekend to give me enough time for the necessary tests? The shorter the duration of the stream, the better.

In the end there are three tracks:

  1. The ambient as own audio track
  2. English as own audio track
  3. already mixed English and French as part of the video stream (this is really one single audio track, nothing to simply mux out)

Their web player does something other than simply muting one track, as the English and French are one single track.

What could be done as a quick fix to automate the removal of the unnecessary audio track by using youtube-dl s --exec parameter that can call ffmpeg after the download finished and remove the videos audio track (3.), leaving you only with the one you want. More info on removing audio tracks via ffmpeg: https://stackoverflow.com/questions/38161697/how-to-remove-one-track-from-video-file-using-ffmpeg

P1st0nBr0ke commented 2 years ago

https://www.rtbf.be/auvio/detail_moto-gp-gp-catalogne?id=2904551

The above link is from a live stream posted this morning - it has the same audio track list.

Thank you for reporting back and for the link. I'll take a look and have a play.

That French/English mixed track is often just French commentary, while the default track, the top one in the list, which appears to be part of the video stream, is usually just ambient noise. They do vary, but the 'Version original' (English) track doesn't, that's if it hasn't been removed prior to moving the live stream to on demand.

At the end of the day, it doesn't matter if both the unwanted tracks are removed or are still there, as long as the English track remains and is selectable if not the only default track.

Having had a bit more time to play with it today, I can see why you weren't keen on having StreamBuffRe compared to a youtube-dl GUI and how incorrect my statement was. It really is a clever piece of software.

Felmachersoft commented 2 years ago

In the new version 0.8.5.0 self made qualities have been added. They allow you to create qualities based on available qualities. So for this specific case you can create a new self made quality by clicking on the 'Edit self made qualities' menu item in the quality selector settings in the main window. From there select 'hls-2256 1280x720 - 128 kb/s' as Video track and 'hls-audio-aacl-128-Multiple_languages - Multiple languages' as Audio Track and provide a name. After adding this quality and clicking 'Ok' in the dialog the new quality with the desired audio and video can be selected and watched.

However, there is one small problem: If you want to download the stream with the correct audio, you will have to explicitly tell that to FFMPEG. In order to do that create a new converter profile (via right clicking on the stream, going to 'download / record stream' -> 'download and convert' -> 'Edit converter profiles') with the custom parameters: -i $VIDEO_INPUT$ -i $AUDIO_INPUT$ -c:v copy -map 0:v:0 -map 1:a:0 Use the new profile to create a file with the correct video and audio.

In order to automatically create the self made qualities there are now self made quality templates, which require a full license. These will automatically create self made qualities after resolving a stream URL. They can be created from the previous dialog or in the URL resolver settings. Read info in the Resolver settings and the popup infos of the textboxes in the dialog to learn more. For your specific case the URL should contain at least www.rtbf.be, Video format should be %best% and Audio format multiple_languages .

If you have additional questions concerning this issue feel free to comment on or contact us directly via mail (contact at felmachersoft dot de).

If you find bugs please open a new issue.