Overview
I am currently developing a media streaming server using ASP.net Core REST Server, utilizing .NET 5.0 and ASP.net Core MVC.
What I'm Looking For
I require the ability to dynamically reduce the resolution of the original video file, such as converting it from 1080p to 720p. Additionally, I need the capability to transcode the media file into different encodings based on client capabilities.
Methods I've Explored
I have been searching for a library that can accomplish this task, but so far, I have not found one. I initially believed FFMpeg could handle this. I am aware that applications like Plex and Emby are able to achieve this functionality successfully.
C#
public static FileStream GetTranscodedStream(string requestedUser, string path, int targetResolution, int targetBitRate)
{
// Code snippet omitted for brevity
}
[HttpGet("{tmdb}/{user}/video/transcoded")]
public IActionResult GetMovieStream(string tmdb, string user, int resolution, int bitrate)
{
// Code snippet omitted for brevity
}
HTML
<link rel="stylesheet" href="/assets/lib/video.js/video-js.css">
<video id="vid1" class="videojs vjs-default-skin" controls data-setup="{}" preload="auto">
<source src="http://127.0.0.1:3208/api/get/movies/299687/dcman58/video/transcoded?resolution=480&bitrate=4800" type="application/x-mpegURL">
</video>
Javascript
var player = videojs('vid1');
player.play();
ERROR
ERROR 416: Range Not Satisfiable "http://127.0.0.1:3208/api/get/movies/299687/dcman58/video/transcoded?resolution=480&bitrate=4800"