Jump to content

Using hard links for movies possible?


Veggav

Recommended Posts

Veggav

I just bought the premiere subscription and I'm excited to use Emby Theater. 

 

The thing is I own, what I can say, one the very best UHD blu-ray players the OPPO 203, that I can access BDMV folders over my network and play full UHD BD rips including the menus.

I know this isn't the main focus of the emby ecosystem so I'm wondering if an alternative to play those movies would be possible. 

 

Instead of using MakeMKV and converting the disc to mkv and wasting twice the space on my hard drives I'm wondering if it would be possible to just make a hard link of the M2TS main movie file.

Put it inside a folder and aim Emby to it. 

 

If so, is hard link the best option?

I know this is an unique scenario but this would be much appreciated if possible. 

 

Also, my server is running unRaid, if that makes any difference. 

Link to comment
Share on other sites

Veggav

Do you have any idea what the syntax would be for files on the computer?

 

Let's say /mnt/user/bluray/file.m2ts ?

Mms://?

Link to comment
Share on other sites

Veggav

It would just be the path to the file.

 

Luke, you are amazing! It worked! :)

My rips are in folder structure on my server. This way I can have full discs with OPPO and movie only with Emby without wasting twice the space. 

 

 

And I need to ask, I've seen several threads about BDMV support and I fully understand that's not what Emby is aimed to.

But are .mpls, playlists, supported at all? 

 

If I find the correct playlist of a blu-ray with BDInfo and point that .mpls file to emby using strm file structure. 

I don't think it would play, would it?

 

EDIT: Just tested it myself. 

It works for regular blu-rays and does not work for UHD Blu-Rays.

 

The same applies adding the full blu-ray or UHD blu-ray rip. Blu-Rays do work and UHD Blu-rays don't. 

 

And I think I know why, I'm quoting this:

Because UHD is slightly different from BD. To play UHD in Kodi right now you can do a little hack. In HEX editor replace:

in index.bdmv: INDX0300 to INDX0200

in MovieObject.bdmv: MOBJ0300 to MOBJ0200

in *.mpls: MPLS0300 to MPLS0200

in *.clpi: HDMV0300 to HDMV0200

 

So as you can see this is minor and would bring support for UHD BDMV folders. 

Since UHD BDMV movies often are movie only, this would be a much more safe option compared to regular blu-rays.

 

And it's just a matter of adding support for a 3 in the place of a 2. 

Edited by Veggav
Link to comment
Share on other sites

Veggav

Yea you can try it but I'm guessing it will not work.

 

I guess you wrote before my edit on the post above. 

 

It works but only for Blu-Rays. 

Of course I can point directly to the m2ts file on UHD BD, this solves but the fix for UHD BD would be trivial (I believe)

 

Now I'm puzzled by the warning:

"Blu-Ray structure is experimental and only supported on some Emby apps"

 

Does Emby Theater on Xbox One is capable of displaying full discs menus from BDMV structure? Or am I getting it wrong?

I guess the Xbox One is the only player capable of this. Not even the Nvidia Shield can play BD or UHD BD menus. 

Link to comment
Share on other sites

The xbox one device is capable, but I'm not even sure those features are available to third party developers. It's not something we've looked at up to this point.

  • Like 1
Link to comment
Share on other sites

Veggav

The xbox one device is capable, but I'm not even sure those features are available to third party developers. It's not something we've looked at up to this point.

 

 

Hey Luke, 

 

I'm messing around with .strm files and one thing that would be of great help is if it would support relative paths instead of absolute paths. 

Not sure if I don't know how to do it or if it's not possible at all.

 

Example:

UHD Blu-Ray full disc ripped to hard drive:

 

/media/MOVIES/TEST/Blade Runner 2049 (2017)/

inside this folder: Blade Runner 2049 (2017).strm

 

The file to be played is in absolute path:

/media/MOVIES/TEST/Blade Runner 2049 (2017)/UHD/DISC/BDMV/STREAM/00336.m2ts

 

I tried changing to ./UHD/DISC/BDMV/STREAM/00336.m2ts 

Since the strm file is loaded from /media/MOVIES/TEST/Blade Runner 2049 (2017)/

 

It does not work. This would be really handy since it would be possible to move a folder + a strm around and there would be no need to change the content inside the strm file.

 

Is it possible somehow to express the currect folder?

Link to comment
Share on other sites

Veggav

It's currently not possible, no.

 

Can't this be implemented? This would be a really awesome feature, image that you can upload all the strm files and they would still work from rclone in the cloud. 

The library would be consistent between servers and file paths and this can't be too hard to implement. 

 

Where can I request this feature? Even if it's some kind of symbol you must add to the file, it would be of great help. 

Link to comment
Share on other sites

Well you can already use strm files to play cloud content, just not full DVD or Blu-ray folder structures.

Link to comment
Share on other sites

Veggav

It's not to be able to play full blurays.

The idea is to be able to keep both options.

 

Please, considere adding it.

Link to comment
Share on other sites

Veggav

What do you mean exactly by both options?

 

I'm going to try to make my case here, please, I know you are busy but read this lenght post to the end because this will be worth it for Emby.

 

When backing up movies you have 2 options, keep the full disc structure or go movie only mkv. 

For preservation sake, the first option is considered better than the later. 

 

Emby is capable of finding the correct M2TS file of the main movie (when it's not a TV Show episodic disc).

I have almost 100 Blu-Rays backed up here and only 6 where not correctly matched.

So this feature works great!

 

When it does not work, there's a very simple workaround to keep the disc and play the movie, a strm file. 

What I did here is:

Have Movie (year)\movie (year).strm

But also Movie (year)\BD\DISC\BDMV and Certificate folder. 

Inside the BD folder it's possible to add .ignore file so Emby will not try to match the DISC, but will use ONLY the .strm file. 

 

This is an awesome solution for EVERY SINGLE blu-ray and UHD blu-ray to be kept as is and stil be compatible with any streaming device, since unpacking m2ts files is not a cpu intensive task and the video and audio are most of the time compilant with chromecast or other devices that support x264 (or x265).

 

Now if we could have relative paths to .strm files this would be the case of doing it only once and leaving it. 

A full disc movie that is fixed once is fixed for good. 

This means, Kodi/JRiver Media Center or the OPPO Blu-Ray player are capable of still playing the discs while Emby can still offer the movie only experience without having to convert anything or having to wast twice the space. 

Also this means that if you back your files to google drive, amazon cloud or any service using rclone and mount that cloud as a drive, the .strm file would still be persistent and would still work. 

 

Having a relative path to .strm file largely increases it`s possibilities.

 

 

Now, as I said this is just the case when Emby isn't capable of finding an appropriated stream and as I've said the number of cases for regular Blu-Rays are really small and this would only be needed in those cases.

 

This is not true to UHD Blu-Rays but IT'S AN EASY FIX. 

 

As I've posted earlier the difference between the structure of a blu-ray and a uhd blu-ray, which Emby isn't capable of finding any streams EVER, is minimal.

 

Basically that's the difference:

in index.bdmv: INDX0300 to INDX0200

in MovieObject.bdmv: MOBJ0300 to MOBJ0200

in *.mpls: MPLS0300 to MPLS0200

in *.clpi: HDMV0300 to HDMV0200

 

What this produces is this error with emby:

Application directory: /system

    System.Exception: System.Exception: Clip info file 00001.clpi has an unknown file type HDMV0300.

 

 The only difference is a HEX string that changes from 2 to 3. 

I know this because that`s the bypass method used in the past for PowerDVD.

 

If I ran a batch script to replace all 3 for 2, emby will find the correct stream and play the UHD Blu-Ray (movie only).

 

So if you follow it till here what I mean is, just add HDMV03000, MPLS0300, MOBJ0300, INDX0300 to be scaned normally. 

Or just put a NOOP on the code while scaning the header of the .mpls, .clpi etc and it will work!

 

 

Ok this is quite long but both features would be amazing and would bring support for so many possibilites to Emby that I really hope you considere adding both. 

Fixing UHD BD requires minimal work. 

 

Adding relative path to .strm files requires more work but if just one could be added I would say this one, because it's a workaround for all discs, 1080p or 4k ones.

 

If you read it here so far, thanks you for your patience.

Link to comment
Share on other sites

Ok I understand what you're saying. Yes I think supporting relative paths in strm files would make sense. 

  • Like 1
Link to comment
Share on other sites

Veggav

Ok I understand what you're saying. Yes I think supporting relative paths in strm files would make sense. 

 

Thank you, Luke! Really looking forward to it! :))

Link to comment
Share on other sites

Veggav

Ok I understand what you're saying. Yes I think supporting relative paths in strm files would make sense. 

 

By the way, still insisting on the UHD BD situation. 

 

This is the error caused by BDInfo:

2019-04-22 07:17:07.920 Error HttpServer: Error processing request
	*** Error Report ***
	Version: 4.1.0.26
	Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
	Operating system: Unix 4.18.20.0
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: True
	Runtime: file:///system/System.Private.CoreLib.dll
	Processor count: 4
	Program data path: /config
	Application directory: /system
	System.Exception: System.Exception: Clip info file 00001.clpi has an unknown file type HDMV0300.
	   at BDInfo.BDROM.Scan()
	   at MediaBrowser.MediaEncoding.BdInfo.BdInfoExaminer.GetDiscInfo(String path)
	   at Emby.Server.MediaEncoding.Encoder.MediaEncoder.GetBlurayM2tsFiles(String rootPath)
	   at Emby.Server.Implementations.Library.BlurayMounter.Mount(String mediaPath, String container, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.IO.MediaMountManager.Mount(String mediaPath, String container, CancellationToken cancellationToken)
	   at Emby.Server.MediaEncoding.Unified.EncodingCommon.AcquireResources(EncodingJobInfo state, CancellationToken cancellationToken)
	   at Emby.Server.MediaEncoding.Api.BaseStreamingService.StartFfMpeg(StreamState state, String outputPath, EncodingOptions encodingOptions, EncodingDiagnosticOptions encodingDiagnosticOptions, CancellationTokenSource cancellationTokenSource, Boolean acquireResources)
	   at Emby.Server.MediaEncoding.Api.Hls.BaseHlsService.ProcessRequest(StreamRequest request)
	   at Emby.Server.Implementations.Services.ServiceExecGeneral.GetTaskResult(Task task)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, ILogger logger, String operationName, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, String urlString, String host, String localPath, CancellationToken cancellationToken)
	Source: BDInfo
	TargetSite: Void Scan()

Now, what version of BDInfo Emby relies on? Because BDInfo, since version 0.7 support UHD BD.

Which would solves this problem.

 

 

BDInfo changelog:

v0.7
 
UHD Bluray support.
HEVC stream detection.
 
 
Version 0.5.10 by git4kUHD
 
I built an updated version for BDInfo that supports UHD playlists.
Requires .NET Framework 4.5.
 
Source:
 
And here's github with full open source code to BDInfo.
 
Do you think BDInfo version could be updated with Emby?
 
 
EDIT and one more info Jellyfin, which is a fork of Emby gets this feature right:
Look at the output here:
[2019-04-22 07:38:47.192 -03:00] [INF] Watching directory /media/MOVIES/TEST
[2019-04-22 07:38:51.334 -03:00] [ERR] Error getting BDInfo
System.Exception: Clip info file 00001.clpi has an unknown file type HDMV0300.
   at BDInfo.TSStreamClipFile.Scan() in /tmp/pkgbuild-0/jellyfin/src/jellyfin-10.3.0/BDInfo/TSStreamClipFile.cs:line 114
   at BDInfo.BDROM.Scan() in /tmp/pkgbuild-0/jellyfin/src/jellyfin-10.3.0/BDInfo/BDROM.cs:line 220
   at MediaBrowser.MediaEncoding.BdInfo.BdInfoExaminer.GetDiscInfo(String path) in /tmp/pkgbuild-0/jellyfin/src/jellyfin-10.3.0/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs:line 40
   at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.GetBDInfo(String path) in /tmp/pkgbuild-0/jellyfin/src/jellyfin-10.3.0/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 340
[2019-04-22 07:38:51.335 -03:00] [ERR] Error in "ffprobe"
System.NullReferenceException: Object reference not set to an instance of an object.
   at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /tmp/pkgbuild-0/jellyfin/src/jellyfin-10.3.0/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 100
   at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /tmp/pkgbuild-0/jellyfin/src/jellyfin-10.3.0/MediaBrowser.Providers/Manager/MetadataService.cs:line 806
[2019-04-22 07:38:51.682 -03:00] [INF] User policy for "nobody". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[2019-04-22 07:38:51.760 -03:00] [INF] Profile: "Unknown Profile", Path: "/media/MOVIES/TEST/Blade Runner 2049 (2017)", isEligibleForDirectPlay: True, isEligibleForDirectStream: True
[2019-04-22 07:38:51.806 -03:00] [INF] Profile: "Unknown Profile", No direct play profiles found for Path: "/media/MOVIES/TEST/Blade Runner 2049 (2017)"
[2019-04-22 07:38:51.965 -03:00] [INF] Profile: "Unknown Profile", Path: "/media/MOVIES/TEST/Blade Runner 2049 (2017)", isEligibleForDirectPlay: True, isEligibleForDirectStream: True
[2019-04-22 07:38:51.965 -03:00] [INF] Profile: "Unknown Profile", No direct play profiles found for Path: "/media/MOVIES/TEST/Blade Runner 2049 (2017)"
[2019-04-22 07:38:52.098 -03:00] [WRN] HTTP Response 200 to "192.168.0.177". Time (slow): 0:00:00.9955358. "http://192.168.0.198:8097/emby/Items/52bf1666525ae54f66c6b5a230a298aa/PlaybackInfo?UserId=20fecbb79fe6476b9b06e96db7c7eb46&StartTimeTicks=0&IsPlayback=true&AutoOpenLiveStream=true&MaxStreamingBitrate=140000000"
[2019-04-22 07:38:52.266 -03:00] [INF] HttpClientManager "GET": "https://image.tmdb.org/t/p/original/sAtoMqDVhNDQBc3QJL3RF6hlhGq.jpg"
[2019-04-22 07:38:52.997 -03:00] [WRN] HTTP Response 200 to "192.168.0.177". Time (slow): 0:00:00.5826771. "http://192.168.0.198:8097/emby/videos/52bf1666-525a-e54f-66c6-b5a230a298aa/master.m3u8?DeviceId=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzczLjAuMzY4My4xMDMgU2FmYXJpLzUzNy4zNnwxNTU1OTI5MDQzMzY5&MediaSourceId=52bf1666525ae54f66c6b5a230a298aa&VideoCodec=h264&AudioCodec=mp3,aac&VideoBitrate=139808000&AudioBitrate=192000&PlaySessionId=4f100a76e75b4f9f8cf6d9d241c96b3c&TranscodingMaxAudioChannels=2&RequireAvc=false&Tag=79b360cf2d3dcd2da9d3dbb42c3d3b89&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=True&h264-profile=high,main,baseline,constrainedbaseline,high10&h264-level=51&TranscodeReasons=ContainerNotSupported"
[2019-04-22 07:38:53.190 -03:00] [INF] /usr/bin/ffmpeg -i file:"/media/MOVIES/TEST/Blade Runner 2049 (2017)/BDMV/STREAM/00336.m2ts" -map_metadata -1 -map_chapters -1 -threads 0 -sn -codec:v:0 libx264 -pix_fmt yuv420p -preset veryfast -crf 23 -maxrate 139808000 -bufsize 279616000 -profile:v high -level 4.1 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames "expr:gte(t,n_forced*3)" -flags -global_header -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 192000  -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3  -individual_header_trailer 0 -segment_format mpegts -segment_list_entry_prefix "hls/6b7ec4f4cf702cc321fee23d30e200c0/" -segment_list_type m3u8 -segment_start_number 0 -segment_list "/config/data/transcoding-temp/6b7ec4f4cf702cc321fee23d30e200c0.m3u8" -y "/config/data/transcoding-temp/6b7ec4f4cf702cc321fee23d30e200c0%d.ts"

So, the fix is already made and just needs to be implemented by Emby.

Here's the code:

https://github.com/jellyfin/jellyfin/tree/master/BDInfo

Edited by Veggav
Link to comment
Share on other sites

Are you sure that Rupan BDInfo is the right one? It hasn't been updated since 2016, whereas the videohelp link you posted has updates that came after that.

Link to comment
Share on other sites

Veggav

Are you sure that Rupan BDInfo is the right one? It hasn't been updated since 2016, whereas the videohelp link you posted has updates that came after that.

 

It seems Rupan was the author and someone named Git4k added 4k support. 

 

Emby uses the BDInfo by Cinemasquid.

I've found the updated, open source version of cinemasquid:

https://github.com/UniqProject/BDInfo

 

Look at BDROM.cs on this github, it was updated 6 months ago.

 

Look at the code:

        private void ReadIndexVersion(Stream indexStream)
        {
            var buffer = new byte[8];
            int count = indexStream.Read(buffer, 0, 8);
            int pos = 0;
            if (count > 0)
            {
                var indexVer = ToolBox.ReadString(buffer, count, ref pos);
                IsUHD = indexVer == "INDX0300";
            }
        }

See? This is the BDRom.cs needed by Emby to support UHD titles.

Just update BDrom.cs on emby git and we are ready to go with 4k Blu-ray :))))

Link to comment
Share on other sites

Veggav

Thanks, we'll look at updating this.

 

I should be the one thanking you, for your time and patience. 

Both features, STRM with relative path and UHD BD support are really welcome additions.

 

I've switched my Emby for the Beta releases and I can do the a bunch of tests and report back when it arrives.

  • Like 1
Link to comment
Share on other sites

  • 8 months later...
TheShoe

reviving an old topic, but was uhd support ever added?

also - if pointing to an mpls file, does that solve seamless branching? problem with relying on an m2ts is that many movies today are split into multiple files.

if this works this would save me a lot of disk space....

Edited by TheShoe
Link to comment
Share on other sites

Not yet because unfortunately it will be a large effort to incorporate those changes due to the changes we've made. So we can't just take them and dump them on top. But we'll get to it.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...