Paracusia 0 Posted March 11, 2019 Posted March 11, 2019 (edited) Hello, I read some threads about .rar support and figured out a solution which also works with remote storages(like gdrive): I currently use following command to live-stream media from rar-files: rar p -inul <rar-file> | ffmpeg -i - -c:v copy -threads 2 -c:a libfdk_aac -b:a 384k -cutoff 18000 -g 48 -keyint_min 48 -sc_threshold 0 -hls_time 5 -hls_playlist_type event -hls_segment_filename %04d.ts play.m3u8 whole script I use: #!/bin/bash cat=$1 name=$2 archive=/home/stream/dump/ path=/home/stream/dump-web/tmp/ if [ -d $path/$name ]; then exit 1; fi mkdir -p $path/$name cd $path/$name unpack="rar p -inul $archive/$cat/$name/*.rar" ffprobe="ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 -i -" echo "codec check.." codecTest=`$unpack | $ffprobe | grep 264` # if video codec != x264, we need to reencode video(expensive)! if [ x$? == x0 ]; then codec="-c:v copy"; else codec="-c:v libx264 -crf 10"; fi echo "codec: $codec" ffmpeg="ffmpeg -i - $codec -threads 2 -c:a libfdk_aac -b:a 384k -cutoff 18000 -g 48 -keyint_min 48 -sc_threshold 0 -hls_time 5 -hls_playlist_type event -hls_segment_filename %04d.ts play.m3u8" echo "transcoding.." echo "$unpack | $ffmpeg"; transcode=`$unpack | $ffmpeg` The browser then just grabs the play.m3u8 with hls.js and plays fine. I'd like to implement this to emby, but I cannot even find any build instructions for linux. Emby would need to look out for *.rar files, then extract any info with ffprobe (which only needs the first .rar file in multiple archives), save it like ever in an .nfo and use the above code the play the media. The HLS stream is continously increasing in duration, until its finally transcoded(usually[most rels are in x264, which is supported by HLS] only the audio needs the be reencoded[from AC3 to AAC], to fit browser support). I'd love to implement this feature in Emby, but I need your help: - which part of code is responsible for media scanning? - which part of code is responsible for playing media? thank you very much beforehand! kind regards Edited March 11, 2019 by Paracusia
Luke 42079 Posted March 11, 2019 Posted March 11, 2019 I need to go over all of the scenarios, but if that's really all that's needed then i can make it possible for you to inject this with a plugin. Granted this means the user would have to supply the native rar executable.
Luke 42079 Posted March 11, 2019 Posted March 11, 2019 i can think of one drawback right off the bat, which is that every stream will have to be processed through ffmpeg. Like for instance, imagine an mp4 inside a .rar, which normally should direct play.
Paracusia 0 Posted March 11, 2019 Author Posted March 11, 2019 I need to go over all of the scenarios, but if that's really all that's needed then i can make it possible for you to inject this with a plugin. Granted this means the user would have to supply the native rar executable. that sound great and would be lovely! i can think of one drawback right off the bat, which is that every stream will have to be processed through ffmpeg. Like for instance, imagine an mp4 inside a .rar, which normally should direct play. currently the script checks for x264 video codec, if its not there, it just transcodes the video too - I think we can handle this dynamically based on the source found in rar file
Luke 42079 Posted March 12, 2019 Posted March 12, 2019 The main problem with this approach though is that it's a forward moving non seekable stream. For instance, if you wanted to resume 23 minutes into the video, how would you do that? It's not so simple to just say use -ss as usual because rar will still have to process everything up to that point.
Paracusia 0 Posted March 12, 2019 Author Posted March 12, 2019 (edited) The main problem with this approach though is that it's a forward moving non seekable stream. For instance, if you wanted to resume 23 minutes into the video, how would you do that? It's not so simple to just say use -ss as usual because rar will still have to process everything up to that point. the stream is seekable to the point where the transcode process currently is, and if someone wants to continue watching somewhere in the middle, he has to wait until the transcode reaches this point, thats the downside - but I could life with it another approach could be: movies which are not completely watched, stay in tmp folder for continue watching at every point Edited March 12, 2019 by Paracusia
Axachi 2 Posted February 11, 2021 Posted February 11, 2021 Any News On this ? Did it ever make it to a plugin?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now