Jump to content

PolyMorphTV Plugin


BeppoMonkeyBoy

Recommended Posts

BeppoMonkeyBoy

5a60b4cc6e2ea_polymorph.png

Hello, I've just uploaded a new plug-in to the catalogue that I've been working on, called PolymorphTV (its in the Sync Section), Basically what it does at the moment is scan for .MKV episodes in your library, and queues them up for conversion (repackaging basically as .mp4's), it puts the resultant files in the same location as the originals (it dosn't destroy the originals), this is to automate processes that some people have to make files compatible with certain clients, be warned if you have a lot of .mkv's it will queue them all up, and because it dosn't destroy the originals you may have a lot of bloat in your library, if this is for you, please use the trail period to take a look and see if this is something you'd use and if you can think of anyway to improve it :)

 

 

  • Like 3
Link to comment
Share on other sites

Could you add some kind of functionality to:

 

If MP4 creates successfully, have Emby verify that the new file will play and has the same running/end time and does have standard audio levels and resolution format, that it would then delete the original?

 

Could you add so that you convert MP4 and MKV to MP4 (H.265 or H.264)? Personally if Emby has spare CPU cycles I want to see it convert my whole library to H.265.

 

If you could do these 2 things, it would allow all of us to create a standard file format for our entire movie/tv collections allowing us to have better playback and instant transport abilities of the files to other devices without any other need for conversion.

  • Like 1
Link to comment
Share on other sites

BeppoMonkeyBoy

BTW, Thank you so much for building this. Emby has needed this forever!

 

I'm looking at ways to improve this, at the moment it simply re encodes using direct stream copy, I'm thinking of playing with how it selects files, and maybe doing a delete on success, but i'll probably do it like sonnar does and select a location to dump the old files in rather than delete them forever, I'm essentially using the ffmpeg in emby to do this, so i can put in options to run any ffmpeg script in code, if you have an example I should be able to make it happen, but at the moment it looks purely for mkv files (but it checks if they are valid first!)

  • Like 1
Link to comment
Share on other sites

after ffprobe, if results = success, delete the original file, then rename the old file to the original name (or just let emby rescan the file).

Link to comment
Share on other sites

what programming language is your plugin in? I might be interested in helping you develop this. I hoping for something that is developed in MS Visual Studio....

Link to comment
Share on other sites

BeppoMonkeyBoy

what programming language is your plugin in? I might be interested in helping you develop this. I hoping for something that is developed in MS Visual Studio....

 

c# .net, using visual studio 2017 :)

Link to comment
Share on other sites

BeppoMonkeyBoy

here is commands to have ffmpeg convert from x to H.265

https://www.maketecheasier.com/encode-h265-video-using-ffmpeg/

 

convert from mp4 to mp4/H265

./ffmpeg -i video.mp4 -c:a copy -c:v libx265 video-h265.mp4

 

Check the video with ffprobe to verify new file is good

ffprobe video-h265.mp4

 

The problem at the moment would be that it would potentially spank the sever doing a full re code, even if its just the video component, I'd have to run a few tests, I'm looking at doing the ffprobe stuff at the moment, but with major re-encodes i always visually check the file by playing it, as re codes can make the quality worse.

Link to comment
Share on other sites

Just set the process to run at x amount of CPU usage. Make the process cpu amount configurable. I would also put in a feature to have it look to see if there are active streams coming from Emby. If there are pause and wait until no streams are in use or something to that nature.

Link to comment
Share on other sites

CPU control for C#: https://stackoverflow.com/questions/989281/how-can-i-programmatically-limit-my-programs-cpu-usage-to-below-70

 

Great example for limiting ffmpeg here: https://social.msdn.microsoft.com/Forums/en-US/27e42fe0-4fd5-46ef-bd50-1188309b38f9/programmatically-limit-cpu-usage-of-a-process?forum=csharpgeneral

 

Example

Process ffmpeg = new Process();
ffmpeg.StartInfo.UseShellExecute = false;
ffmpeg.StartInfo.FileName = "..\ffmpeg.exe";
ffmpeg.StartInfo.Arguments = "-threads 2"; // <=== Add this line
ffmpeg.StartInfo.CreateNoWindow = true;
ffmpeg.Start();

 

This example limits the usage of ffmpeg of a 4 core processor to 50% usage....

https://stackoverflow.com/questions/4565567/how-can-i-limit-ffmpeg-cpu-usage

Link to comment
Share on other sites

BeppoMonkeyBoy

here is commands to have ffmpeg convert from x to H.265

https://www.maketecheasier.com/encode-h265-video-using-ffmpeg/

 

convert from mp4 to mp4/H265

./ffmpeg -i video.mp4 -c:a copy -c:v libx265 video-h265.mp4

 

Check the video with ffprobe to verify new file is good

ffprobe video-h265.mp4

 

if you use the beta version I've just posted on the plugin library, there should be a new scheduled task to do mkv to H.265, it took 6 mins to to my 1min 30 second test file to H.265, (only does this if you havn't got a .mp4 field of the same name in the same location), the plugin uses the emby processFactory to I don't have control of the cpu cycles, but it should manage it the same way the emby sync works, and manage it smartly (I assume).

 

Fair warning I'd delete the default task schedule after first install.

Link to comment
Share on other sites

Any way to add it so it can do H.265 conversion for either MKV or MP4 file types? The idea here is to get all your files to the same format and compression ratios.....

Link to comment
Share on other sites

BeppoMonkeyBoy

Possibly, I’d have to take a look when I get chance, the current h.265 task will convert any mkv to h.265 .mp4 but thinking about it more I’d have to validate that’s it’s not already h.265 other wise it would be redundant and you’d might as well do a standard re package

Link to comment
Share on other sites

BeppoMonkeyBoy

Possibly, I’d have to take a look when I get chance, the current h.265 task will convert any mkv to h.265 .mp4 but thinking about it more I’d have to validate that’s it’s not already h.265 other wise it would be redundant and you’d might as well do a standard re package

Latest beta fixes this.

Link to comment
Share on other sites

Could you add a feature so that it could only look at a specific folder. The folder I am thinking of would be a workflow type folder. Put stuff here, it will get converted, then delete the original, then move the file to a location based on what group in Emby you want to see it go in (TV or Movies). If you could add this, this could become a workflow process so that when you download new content, instead of putting it into a folder that emby scans, put it to your temp folder, then your process takes it over, updates it to the right format/codec/filetype/etc, then moves it to the folder of your choice for emby to use. This would make it so that any new data only goes thru your process before a user can even see it/watch it. This would help enforce standards and allow you to get any new data to a standard format right away.

  • Like 1
Link to comment
Share on other sites

BeppoMonkeyBoy

Could you add a feature so that it could only look at a specific folder. The folder I am thinking of would be a workflow type folder. Put stuff here, it will get converted, then delete the original, then move the file to a location based on what group in Emby you want to see it go in (TV or Movies). If you could add this, this could become a workflow process so that when you download new content, instead of putting it into a folder that emby scans, put it to your temp folder, then your process takes it over, updates it to the right format/codec/filetype/etc, then moves it to the folder of your choice for emby to use. This would make it so that any new data only goes thru your process before a user can even see it/watch it. This would help enforce standards and allow you to get any new data to a standard format right away.

 

Possibly, but this kinda duplicates what the the auto organize function does, my thoughts where around using tags on series, or some other method, using the task in the default plug in is relativity fast (mkv to mp4), the h265 one in the beta is a bit of a beast.

Link to comment
Share on other sites

I guess I'm missing something obvious, but this plugin doesn't seem to install.  That's to say, it says it has installed successfully, but it does not then appear after restarting emby in the list of my installed plugins.

 

I guess I'm missing something obvious...  I've tried installing ffmpeg in case that's a separate prerequisite, but that didn't help.

Link to comment
Share on other sites

BeppoMonkeyBoy

I guess I'm missing something obvious, but this plugin doesn't seem to install.  That's to say, it says it has installed successfully, but it does not then appear after restarting emby in the list of my installed plugins.

 

I guess I'm missing something obvious...  I've tried installing ffmpeg in case that's a separate prerequisite, but that didn't help.

 

You don't need to install anything else, it uses the ffmpeg bundled with emby :)

 

What version of emby server are you using and what are you running it on?

Link to comment
Share on other sites

Great plugin!

 

Is there a chance to get the other way additionally (MP4 to MKV)?

And perhaps an option (which have to e activated) to delete the original files immediately after the remux? I know what I'm saying! ;)

Link to comment
Share on other sites

BeppoMonkeyBoy

You don't need to install anything else, it uses the ffmpeg bundled with emby :)

 

What version of emby server are you using and what are you running it on?

 

Never mind.. I realised what the issue is, its installing the plugin without the .dll extension, it should be fine from here on out

Link to comment
Share on other sites

BeppoMonkeyBoy

Great plugin!

 

Is there a chance to get the other way additionally (MP4 to MKV)?

And perhaps an option (which have to e activated) to delete the original files immediately after the remux? I know what I'm saying! ;)

 

In the version i'm tinkering with at the moment, it moves the old files to a location (for easy undo), i'm tinkering with stripping subtitles to .srt files, and simple remuxing, i'm trying to work out the best way to select files (at the moment its all done on the whole library and just mkv's), but once i get my head around the best way to do it i can try and run it on all file types, and probably put in custom ffmpeg commands in a setting somewhere.

  • Like 4
Link to comment
Share on other sites

.... stripping subtitles to .srt files, ....

 

YES, YES, YES!!! This would really help Apple TV users...

  • Like 1
Link to comment
Share on other sites

Never mind.. I realised what the issue is, its installing the plugin without the .dll extension, it should be fine from here on out

 

Thanks!  It's now installed.

Edited by pwhodges
Link to comment
Share on other sites

  • 2 weeks later...
BeppoMonkeyBoy

here is commands to have ffmpeg convert from x to H.265

https://www.maketecheasier.com/encode-h265-video-using-ffmpeg/

 

convert from mp4 to mp4/H265

./ffmpeg -i video.mp4 -c:a copy -c:v libx265 video-h265.mp4

 

Check the video with ffprobe to verify new file is good

ffprobe video-h265.mp4

 

The problem with this is the tests I've run converting files do indeed produce smaller files but the quality is far worse,

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...