Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VOD profile for original source file? #54

Open
metal450 opened this issue Jun 15, 2024 · 10 comments
Open

VOD profile for original source file? #54

metal450 opened this issue Jun 15, 2024 · 10 comments
Labels
enhancement New feature or request

Comments

@metal450
Copy link
Contributor

In config.yaml, we can define video-profiles like i.e.

video-profiles:
    360p:
      width: 640
      height: 360
      bitrate: 800
    540p:
      width: 960
      height: 540
      bitrate: 1800

Is there a way to have an "original file" profile? i.e. to optionally just serve up the source .mp4, without any transcoding?

If not, would love it as a feature request :)

@m1k1o
Copy link
Owner

m1k1o commented Jun 15, 2024

without any transcoding

That would be only possible if the original file is already transcoded in the correct format (correct video/audio codec, acceptable GOP length, etc.). So we would need to verify first if the source is compatible and then allow direct passthrough with only segmenting. Otherwise we would need to either fallback to transcoding anyway or throw an error.

@metal450
Copy link
Contributor Author

That would be only possible if the original file is already transcoded in the correct format

You mean if the original file is in some format that supports streaming (i.e. h264, not h265)?

Basically, I have a video library on a Synology NAS. Through their UI, I'm actually able to browse the files, and play them directly (not with transcoding). So when I'm "close to the NAS" (i.e. on the same LAN or with fast internet), I can watch directly; when I'm on slow Internet, I can watch transcoded via go-transcode. It'd be great if go-transcode could provide the original file as an option, that way I could use it as the sole access point for the videos - use the "direct stream" when internet is fast enough, switch to transcoding otherwise. Does that make sense?

@m1k1o
Copy link
Owner

m1k1o commented Jun 16, 2024

It would only be needed if you want to play it on the web. If only using VLC, you can basically just serve the file using a webserver. Depends on the codec, VLC should be able to just request the byte ranges of the file that are actually needed.

An idea, to basically just serve the files as they are, you can try out: master...vod-serve-files

So if you would play http://127.0.0.1:8080/vod/MyFile.mp4 in VLC, it should work. And if you need transcoding, you can still request using the old format.

@metal450
Copy link
Contributor Author

An idea, to basically just serve the files as they are, you can try out: master...vod-serve-files

Yup, that works great :)

The only thing I'd possibly add is, it would be awesome to actually have it as an option in the index - that way it could also be selected from the quality selector (i.e. in the web player or some desktop players). Granted that, as you said, if the file is the wrong format it might not be able play, but that's fine. i.e. maybe some special-case profile, like:

video-profiles:
    360p:
      width: 640
      height: 360
      bitrate: 800
    540p:
      width: 960
      height: 540
      bitrate: 1800
    original:
      original: true // or however to best denote it

Just an idea. What you did so far is already great tho :)

@m1k1o m1k1o added the enhancement New feature or request label Sep 22, 2024
@metal450
Copy link
Contributor Author

@m1k1o any chance of squeezing this in? Would be amazingly useful to be able to pick the original file in the web player. 🙏

@m1k1o
Copy link
Owner

m1k1o commented Sep 22, 2024

In order to have it as part of the master playlist, it would need to be segmented the same way as the rest of the qualities. And it can be only segmented on a keyframe. And a keyframe can only be added when transcoding. So we must make sure that only existing keyframes are used from the file that are already there - it could create segments with variable length.

The reason why it is difficult to have it in a single player as a quality option is, that the specification requires this keyframe alignment to be able to switch anywhere in file to a better or worse qualtiy (based on the netwok conditions).

If we would add just the whole file without being transcoded as an option, it must not work properly. We can try it out, maybe the player is "forgiving" or can handle this case, though it is not part of the specification.

@metal450
Copy link
Contributor Author

metal450 commented Sep 22, 2024

Ah, I see. Ok, I have maybe a much better/easier idea then.

Currently, when the player first comes up, it hasn't started playing yet (until you click it / the play button in the center).

What about also having a hover button, i.e. maybe in the top corner or something, that can be clicked to just direct you to the original file. That way you can either click the play button to watch the transcoded version, or click the hover button/link to redirect to the original.

Much easier, & easily accomplishes making them both available from the original location :)

@m1k1o
Copy link
Owner

m1k1o commented Sep 22, 2024

Yes, that could be easier to acomplish. Or even intercept somehow the GUI of the player where you can choose quality, and you could just choose original and it would just start playing from begining.

@m1k1o
Copy link
Owner

m1k1o commented Sep 22, 2024

I added such button here: https://github.com/m1k1o/go-transcode/tree/vod-serve-files

Maybe you could find a better way how to incorporate it into the player, to make it better UX.

@metal450
Copy link
Contributor Author

Beautiful! Good enough to merge IMO :)

fwiw, here's my remaining wishlist, building on top of this. Just food for thought/icing on the cake:

  • Query arg for if you were viewing original or transcoded. That way you can go straight to "original" if desired - or i.e. if u refresh the page, it will reload the same state. (could just reuse the same query arg I previously added, with a special case value to indicate 'original')
  • Query arg to disable autoplay. Currently, the remote device starts ffprobe the moment you hit the url (not just after you hit play). The goal here is to be able to be able to select quality before putting the remote cpu to work - it only goes to work if you actually intend to watch the transcoded version.
  • And likewise, similar UI to your button for toggling between "transcode vs original quality", would be cool to be able to select the initial transcoder quality before the transcoder goes to work. This is what I had in mind when adding my query arg - a way to visit the page & avoid it starting to transcode at a quality that I wasn't going to use. With a UI, wouldn't have to remember to pre-mangle the URL to your desired quality - could just visit the base URL, pick your transcode quality, THEN start playing, and it would go straight to transcoding that quality - rather than going to work at another quality first, then you switch to yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants