INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Decompress large video files on the fly, and view in JRiver.  (Read 16372 times)

jachin99

  • Citizen of the Universe
  • *****
  • Posts: 559
Decompress large video files on the fly, and view in JRiver.
« on: April 11, 2016, 07:58:17 pm »

I'm running out of hard drive space, and it would be nice to store my videos, and TV in a compressed format to save space.  Is there a program that can decompress them, and pass them to jriver smoothly without sacrificing quality?
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #1 on: April 11, 2016, 08:22:22 pm »

Hah. No. There are also no unicorns.

All videos you have are already compressed, lossily to boot. MC does what you're asking for. That's what LAV (part of Red October) does. Decode a variety of compressed video formats.

You can certainly recompress them and make them smaller, and perhaps do a very good job, but not completely losslessly.

Uncompressed video is truly enormous. 8-bit uncompressed 1080p at 24fps is 334GB per hour of video, not including the audio size. One feature length movie would essentially fill a 1TB drive.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

jachin99

  • Citizen of the Universe
  • *****
  • Posts: 559
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #2 on: April 11, 2016, 08:33:07 pm »

Whats the best compression format in terms of audio and video quality?  About how big do the file sizes end up? Whays the best way to accomplish this?
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #3 on: April 11, 2016, 08:52:48 pm »

Whats the best compression format in terms of audio and video quality?  About how big do the file sizes end up? Whays the best way to accomplish this?

That is way beyond the scope of this forum. Doing a LOT of reading on Doom9 would be a good place to start:
http://forum.doom9.org/

Poking around on the Handbrake forums and community might be another good place to start:
https://handbrake.fr/community.php

But be aware, any question like the one above is going to be met with derision, if not outright hostility.

All common video compression technologies, aside from lossless ones, have strengths and weaknesses. People get degrees specializing in video compression. I've done professional video editing and compression for 13 years and I still have a ton to learn.

Lossless video compression algorithms (like FLAC, but for video) would still be an order of magnitude larger than the already-lossy-compressed formatted video you have now. Even content ripped directly from BluRay is heavily compressed in one of a variety of different types of compressors (as I said above, uncompressed 1080p video would give you one movie per 1TB hard drive). Even when the movies are made they are typically using one of a few high-quality (but usually still not lossless) compression systems, and more commonly, two or three different ones.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

jachin99

  • Citizen of the Universe
  • *****
  • Posts: 559
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #4 on: April 11, 2016, 08:54:03 pm »

I'll head over to these sites, and read up.  Thanks.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #5 on: April 11, 2016, 09:00:41 pm »

For you at the outset of your adventure:
https://www.youtube.com/watch?v=pHte24GGHD4
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #6 on: April 11, 2016, 09:13:18 pm »

So here's the deal:

A.  If your videos are lossy compressed with H.264 or a similar algorithm, they are already pretty small.  You could try to re-encode them with a more modern CODEC like H.265 and probably make some gains.  I.E., you could probably significantly shrink the files.  But the danger in doing so is that you could easily lose video quality in the process.  It will also "cost" you a LOT of processing time to encode with a CODEC like H.265.  Think on the order of some small number of hours per typical movie file.  Also consider how long it will take you to figure out the correct parameters for the processing and how long you will have to spend doing experiments on various videos to test the visual effect of the new CODEC.  I.E., can you see a visual difference after the recompression?

B.  If your files are lossy compressed with the original compression format from DVD or BD, you can probably significantly compress them further with H.264 or H.265.  But all of the above applies:  Danger to video quality and lots of time required.

C.  You won't have any uncompressed video, but if you did, you could compress that a LOT.  Uncompressed video typically only comes from very high end cameras or as intermediate files in digital video editing systems.

D.  But ultimately you're chasing your tail.  Because, as I noted in your last thread about this, storage is dirt cheap.  100 typical BD rips are going to fit into around 2 TB.  A fairly large video collection with 500 rips of HD movies from BDs would then be around 10 TB.  You can buy 2 external USB drives at 5 to 6 TB each for around $260 right now.  Next year they will be cheaper.

My rule in digital media of all types is, NEVER seek to compress to save space.  More space is always cheap and you'll never regret having the full resolution files (of any type).  You'll also never waste vast amounts of time trying to recompress data that might be harmed by this process.

Good luck.

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #7 on: April 11, 2016, 09:36:41 pm »

<Nerd mode engaged>

Uncompressed video typically only comes from very high end cameras

I know of no high-end camera that records directly to uncompressed 4:4:4 video in HD (and certainly not at 4 or 8k). Perhaps there are one or two out there for green screen shots or something, but if so, I don't know about them (and I know about a lot).

Basically all high-end video cameras record in some kind of lossy compressed format, like REDCODE, Avid DNxHD, Apple ProRes, Sony's XAVC, or some similar format. Even ARRIRAW is not really uncompressed, even though it is the RAW sensor data (because the sensor doesn't output full 12-bit RGB, but uses Bayer frames). That's probably close to as uncompressed as you get on a camera, though, at least in modern times. Perhaps some much older Standard Def digital cinema cameras did it, but all digital workflows were never adopted by the industry until well into the HD era (and there are still plenty of big-budget movies shot on film and scanned).

or as intermediate files in digital video editing systems.

Technically, intermediate files are sometimes uncompressed, particularly when output from digital effects suites, but that's incredibly rare, except for green screen shots (and even with those anymore, really). Usually when that term is used, it refers to the intermediate files used to edit temporally compressed source video like MPEG-2 or H.264 native sources, and for that, the NLE would use an intermediate codec like Apple ProRes (or, in olden times, AIC), Avid DNxHD, or whatever Adobe calls theirs.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #8 on: April 11, 2016, 09:41:22 pm »

<Nerd mode set back to normal>

My rule in digital media of all types is, NEVER seek to compress to save space.  More space is always cheap and you'll never regret having the full resolution files (of any type).  You'll also never waste vast amounts of time trying to recompress data that might be harmed by this process.

Agreed completely.

It is not likely to be worth the time and energy to figure this stuff out. If you really don't care about quality, and you don't care that it'll take hours to recompress a single video, you could play around with Handbrake and get some decent storage savings versus raw rips from BluRay.

But you'll absolutely be throwing away quality that can't be gotten back without re-ripping the original source.

Working overtime and buying more hard drives is likely to be a better use of your time, especially if you're starting from scratch and asking these kinds of questions.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #9 on: April 11, 2016, 09:49:06 pm »

I know of no high-end camera that records directly to uncompressed 4:4:4 video in HD (and certainly not at 4 or 8k). [...]

Basically all high-end video cameras record in some kind of lossy compressed format, like REDCODE, Avid DNxHD, Apple ProRes, or some similar format.

Yeah, you're right.  I was actually thinking about the RED cameras when I wrote that, but I forgot that they use "wavelet compression" (or is it some other pixie dust I can't remember like fractal compression?).  In any case, I think you're right because I can't think of an example of anything that actually produces straight up uncompressed video.

Quote
Usually when that term is used, it refers to the intermediate files used to edit temporally compressed source video like MPEG-2 or H.264 native sources, and for that, the NLE would use an intermediate codec like Apple ProRes (or, in olden times, AIC), Avid DNxHD, or whatever Adobe calls theirs.

You're right again.  I was thinking of ProRes or the equivalent where the editing format files use tons more key frames and a less aggressive compression which means these files are WAY larger than you'd expect from typical compressed video (like H.264).  But these aren't "raw video" as you've corrected me.

This was a fun little detour into video tech land.  :)

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #10 on: April 11, 2016, 09:56:57 pm »

Yeah, you're right.  I was actually thinking about the RED cameras when I wrote that, but I forgot that they use "wavelet compression" (or is it some other pixie dust I can't remember like fractal compression?).  In any case, I think you're right because I can't think of an example of anything that actually produces straight up uncompressed video.

Yep. REDCODE is a wavelet based encoder. I think HEVC (H.265) is as well, though I don't remember and am too lazy to look on Wikipedia. Wavelet based encoders have been all the rage for the past few years. That's lossy though, of course.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #11 on: April 11, 2016, 10:08:00 pm »

Incidentally, as a video nerd, I find it amusing that people (not just you) will refer to a RED camera as a "high-end" camera. RED's whole thing was that they brought all-digital, high-quality, 4K cameras "to the masses" via dramatically cheaper prices (and innovative recording codecs and technology and improved ease-of-use).

The original RED One was $17,500 for just the camera body at launch (which didn't include batteries, media, shoulder pads, glass, or a whole swath of other required gear). A typical RED One rig would actually cost around $30k.

But their main competition was ARRI and Sony cameras that started at the cost of an upscale McMansion and went easily to the low 6 figures.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #12 on: April 11, 2016, 10:13:11 pm »

This was a fun little detour into video tech land.  :)

I know.  ;D

Possibly confusing and certainly irrelevant to the OP, but fun!
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #13 on: April 13, 2016, 09:20:52 am »

I leave all my movies (with a few exceptions) in the format they were originally (Typically use Make MKV to rip).

TV shows are watched as the original format, and then I have a script that every night will use handbrake to compress the videos further to a lower resolution (852x480 iirc).  It's nice, I have automated almost the entire process, and the resulting files are roughly 10% the size of the original.  Yes, the quality isn't near as good, but I only save these so that I can go back and watch them later, so it is an acceptable tradeoff, and to be honest, the quality on a 1080 TV isn't horrible.  I have 2831 files on my TV drive, and it is roughly 1.8 TB of space.  I would say that most of these, if not all, are 1 hour episodes of TV.
Logged

imeric

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1466
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #14 on: April 13, 2016, 09:57:22 am »

<Nerd mode set back to normal>
<Nerd mode engaged>
;D ;D ;D Very funny! (And informative...)
I have a script that every night will use handbrake to compress the videos further
Muzicman would you mind sharing a little more on this?  I've done something similar with the help of MC-TV running in the background and customising it with handbrake.  It did work but was not fully automatic...I also wanted to use Dirmon whcih I use for comskip and srt generation but didn't work with the handbrake CLI for compression...

Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #15 on: April 13, 2016, 10:14:17 am »

Sure...it's basically just a vbs script that I call using Windows task scheduler.  It scans the Recorded TV folder (not recursively, so ONLY that folder, not sub folders).  It compares the file names that it finds to a text file I create, and if the name matches (actually, not a complete match...if the text file has Marvel in it, it will match ANY file that begins with Marvel, so Marvel's Agents of SHIELD, or Marvel's Agent Carter, etc will match), then it adds that file to a batch file that uses HandbrakeCLI.exe to process the file.  Once processing is done, then it moves the original file to Recorded TV\Processed.  Once the entire batch file is done, it runs a auto import to update the new file locations of the original.  Typical Batch file output from the .vbs script would be someting like this:
Code: [Select]
"C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "D:\Recorded TV\Marvel's Agents of S.H.I.E.L.D. - S03E16 - Paradise Lost.ts" -t 1 --angle 1 --start-at duration:7 -o "T:\Compressed\Marvel's Agents of S.H.I.E.L.D. - S03E16 - Paradise Lost.ts.mp4" -f mp4  --decomb="bob" -w 854 -l 480 --crop 0:0:0:0 --modulus 2 -e x264 -q 20 -r 29.97 --cfr -a 1 -E av_aac -6 stereo -R Auto -B 320 -D 0 --gain 0 --audio-fallback ac3 --encoder-preset=veryslow  --verbose=1

move /Y "D:\Recorded TV\Marvel's Agents of S.H.I.E.L.D. - S03E16 - Paradise Lost.ts" "D:\Recorded TV\Processed\"

"C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "D:\Recorded TV\NCIS - S13E12 - Sister City_ Part One.ts" -t 1 --angle 1 --start-at duration:7 -o "T:\Compressed\NCIS - S13E12 - Sister City_ Part One.ts.mp4" -f mp4  --decomb="bob" -w 854 -l 480 --crop 0:0:0:0 --modulus 2 -e x264 -q 20 -r 29.97 --cfr -a 1 -E av_aac -6 stereo -R Auto -B 320 -D 0 --gain 0 --audio-fallback ac3 --encoder-preset=veryslow  --verbose=1

move /Y "D:\Recorded TV\NCIS - S13E12 - Sister City_ Part One.ts" "D:\Recorded TV\Processed\"

"C:\Windows\System32\MC21.exe"/mcc 23020,1
I run the vbs script that creates the batch file at 10:58PM, and then run the actual batch file at 12:05AM every day.  I figure this gives any programs that are currently recording time to finish before trying to process with Handbrake.

The .vbs script code is below, keep in mind you would probably need to adjust paths, etc to make it work for you.

Code: [Select]
Set objFSO = CreateObject("Scripting.FileSystemObject")

objStartFolder = "D:\Recorded TV"
objMoveFolder = "D:\Recorded TV\Processed\"
objCompressedFolder = "T:\Compressed"
objHandbrakePath = "C:\Program Files\Handbrake\HandBrakeCLI.exe"
outFile = "C:\Users\Administrator\Desktop\CompressFiles.bat"
strFile = "C:\Users\Administrator\Desktop\CompressFilesSettings.ini"
boolMatch = false

Set objFile1 = objFSO.CreateTextFile(outFile,True)
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files

For Each objFile in colFiles
If UCase(objFSO.GetExtensionName(objFile.name)) = "TS" Then

Set objFile2 = objFSO.OpenTextFile(strFile)
Do Until objFile2.AtEndOfStream
strLine= objFile2.ReadLine

If strLine = Left(objFile.name, Len(strLine)) and Len (strLine) > 0 Then
boolMatch = true
End If

Loop
objFile2.Close

If boolMatch then
objFile1.Write chr(34) & objHandbrakePath & chr(34) & " -i " & chr(34) & objStartFolder & "\" & objFile.name & chr(34) & " -t 1 --angle 1 --start-at duration:7 -o " & chr(34) & objCompressedFolder & "\" & objFile.name & ".mp4" &chr(34) & " -f mp4  --decomb=" & chr(34) & "bob" & chr(34) & " -w 854 -l 480 --crop 0:0:0:0 --modulus 2 -e x264 -q 20 -r 29.97 --cfr -a 1 -E av_aac -6 stereo -R Auto -B 320 -D 0 --gain 0 --audio-fallback ac3 --encoder-preset=veryslow  --verbose=1" & vbCrLf & vbCrLf & "move /Y " & chr(34) & objStartFolder & "\" & objFile.name & chr(34) & " " & chr(34) & objMoveFolder & chr(34) & vbCrLf & vbCrLf

boolMatch = False
End If
End If
Next
objFile1.Write chr(34) & "C:\Windows\System32\MC21.exe" & chr(34) & "/mcc 23020,1" & vbCrLf & vbCrLf
objFile1.close
One final note...some versions of Windows can run a vbs file from task scheduler, and some can't...the workaround for those that can't (IE: Windows 10) is to create a simple batch file to call the .vbs file and run that through task scheduler.

Oh, and you will notice that I skip the first 7 seconds of the video file being processed...you may not need to do that...I find that if I don't, then I have a fairly high possibility that I will have A/V sync issues in the output.  Since I use 1 minute of padding in the beginning of each recorded TV file, it's not an issue to start 7 seconds in.

Last thing...the .ini file (text file that has file names in it) seems to be case sensitive, so Marvel is different than marvel.  I was also concerned that apostrophe's ("'") would have issues, but they don't.  So, Marvel's is fine.

I typed this up quickly, so if you have any questions, or something doesn't make sense, just let me know!
Logged

imeric

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1466
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #16 on: April 13, 2016, 11:22:48 am »

muzicman0 this is very generous of you to share your scripts thank you so much!  I'll definitely give this a try as I already have handbrake tweaked with compression settings to my liking.

The only missing link was to find a simple way to automate it...

Thanks!
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #17 on: April 13, 2016, 03:07:09 pm »

A couple notes regarding my work flow.  I don't have the Compressed folder (where the compressed files go - T:\Compressed) set up on auto import, I manually copy them over.  It would be easy enough to add it, but I don't.  I also record in .ts format, this won't work if using .jtv.  I will manually delete the original recording after watching, and manually move the compressed file over to a directory.  Sometimes I will move it to a 'staging' directory, then use the Move, rename, copy function in JRiver, or sometimes I will just copy it to the correct folder in my structure.

I think that about covers it.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #18 on: April 13, 2016, 04:07:46 pm »

You may want to take a look at MCAutoQueue:
http://yabb.jriver.com/interact/index.php?topic=76147.0

This would allow your VBS script to be much simpler. I use this, and wrote it, for basically the same purpose. It is essentially an automated processor for MC which is driven by a Smartlist.

With this, rather than parsing a directory location in your VBS script, you would have a smartlist in MC that feeds MCAutoQueue a list of files. Then, MCAutoQueue would go through the list and run the VBS script on each one in turn.

That, plus the MCFileIngester utility (which is included) would allow you to automatically process your recordings while:
* Still having access to the originals in MC before processing.
* Once the processor has run, it can replace the existing Library entry in MC, rather than importing a new file fresh (so you don't lose [Date Imported], [Last Played], [Number Plays], etc).
* Much more flexible because the files can be fed from a variety of filesystem locations without requiring any modification to your script.

And, your VBS script would be much simpler. Basically you'd just have to handle the transcoding, and then feed it to MCFileIngester to do the importing/replacement of the original in MC's Library.

It works quite well. And it is free.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

imeric

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1466
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #19 on: April 13, 2016, 06:03:50 pm »

Thanks!!!
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #20 on: April 13, 2016, 06:14:57 pm »

You may want to take a look at MCAutoQueue:
http://yabb.jriver.com/interact/index.php?topic=76147.0

This would allow your VBS script to be much simpler. I use this, and wrote it, for basically the same purpose. It is essentially an automated processor for MC which is driven by a Smartlist.

With this, rather than parsing a directory location in your VBS script, you would have a smartlist in MC that feeds MCAutoQueue a list of files. Then, MCAutoQueue would go through the list and run the VBS script on each one in turn.

That, plus the MCFileIngester utility (which is included) would allow you to automatically process your recordings while:
* Still having access to the originals in MC before processing.
* Once the processor has run, it can replace the existing Library entry in MC, rather than importing a new file fresh (so you don't lose [Date Imported], [Last Played], [Number Plays], etc).
* Much more flexible because the files can be fed from a variety of filesystem locations without requiring any modification to your script.

And, your VBS script would be much simpler. Basically you'd just have to handle the transcoding, and then feed it to MCFileIngester to do the importing/replacement of the original in MC's Library.

It works quite well. And it is free.
I actually (for me), don't want it to import or replace the file.  I end up seeing 2 versions a lot of the time, and get confused on which is which if both are imported.  So the manual process of importing the compressed file is good for  me...

and of course, my script/handbrake is free also :)
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #21 on: April 13, 2016, 07:05:02 pm »

You misunderstand.

You can replace existing entries, and even delete (from disk) the old for the new if you choose. There are no two separate files.

That's the whole idea. To automate that.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

imeric

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1466
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #22 on: April 14, 2016, 08:08:03 am »

What's in bold is actually what makes this automated process very appealing to me...Never managed to get this to work properly in Sage...
Maybe I could even squeeze in comskip (generating edl + srt for me) to run within MC with this process?


* Still having access to the originals in MC before processing.
* Once the processor has run, it can replace the existing Library entry in MC, rather than importing a new file fresh (so you don't lose [Date Imported], [Last Played], [Number Plays], etc).
* Much more flexible because the files can be fed from a variety of filesystem locations without requiring any modification to your script.


And, your VBS script would be much simpler. Basically you'd just have to handle the transcoding, and then feed it to MCFileIngester to do the importing/replacement of the original in MC's Library.

It works quite well. And it is free.

And by using smartlists...I assume it would also allow you to only transcode files older than a certain period of time with specific genres etc...All the customising on which files you want is done there no matter where they are on your PC...Sweet...Can't wait to try this out!!!

I think we digressed a little and may have lost the OP along the way but it's been very informative  ;)

Thx Glynor and muzicman0!
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #23 on: April 14, 2016, 12:09:51 pm »

You misunderstand.

You can replace existing entries, and even delete (from disk) the old for the new if you choose. There are no two separate files.

That's the whole idea. To automate that.
I'm probably still not getting it! 

Is it possible to configure it so that it will only process the files AFTER watching it once?  So basically, I watch it in HD, then after that, at a predetermined time (middle of night), it will transcode it and replace the existing file, and move it to the correct folder?  It would still have to use Handbrake, not MC (I don't think the quality vs file size is as good in MC), and I would want to have the processing done in the middle of the night...

IF this is possible, can you point me in the right direction on how to implement?

If so, I could definitely see value in that.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #24 on: April 14, 2016, 06:15:15 pm »

Sure can. MCAutoQueue is really quite simple:

1. Make a new Library Field in MC called [Needs Processing]. This will contain a "keyword" which MCAutoQueue will use to decide how you want that file processed. So, for example, you could put a value in this field called "muzicman0's script". This field needs to be set to an appropriate value for each file that you want processed. I use Tag On Import rules to automatically set this. So, it says if the file is a TS file, and it is one of these kinds of files (from this set of Series) then add this keyword to [Needs Processing].

In your case, you'd Tag on Import all files that you might want to process (once number of plays has incremented) with this keyword.

2. Create a Smartlist in MC that will contain the files you want to process. Usually this would just be [Needs Processing] is not Empty, Completed, or Failed. But you could also add restrictions to the smartlist instead (which would keep your [Needs Processing] expression simpler).

In your case, you would make a smartlist that says: [Number Plays] > 1 (and other restrictions to make sure it shows the files you want handled). Any Playlist in MC will do, so you could even use a manual playlist if you want to queue them manually.

3. Open up MCAutoQueue and click the Settings button. Point it at the Smartlist you created. There's a drop-down that lists all the Playlists in MC.

4. Add a new Processor to the list of processors (you can delete my example ones which you won't use) and add the keyword you added in step 1 as the Processor Key.

5. Add the path to a command line application to run, and any arguments needed. For the arguments, you can use any field in MC in normal square-bracket notation. Usually this would just be [Filename] but it could be anything you want.

6. The MC Style option is explained in the documentation in the other thread, and is probably not needed for simple purposes (it basically lets you use expressions in there). Update MC tells it to update the [Needs Processing] value with a resulting status (otherwise it is left untouched). Timeout will force-quit the script run once it expires (if you have stuff in there that might crash or fail).

That's pretty much it. Now you can run MCAutoQueue and it'll do its stuff to one file at a time, in whatever order they're in in the Smartlist.

But, MCAutoQueue itself has command line options (documented in the thread) so that it can, itself, be automated. The idea being that you set it up, and then you schedule it to run in the Windows Task Scheduler to happen automatically when you're away from the computer.

The end. Your stuff will auto-process based on the rules you created.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #25 on: April 14, 2016, 06:18:49 pm »

Awesome, I will give it a shot this weekend and see how it goes.  If this could automate everything for me, I would love it!  Thanks!
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #26 on: April 14, 2016, 06:43:31 pm »

It should be able to. It does for me. I'd actually be interested in trying it with Handbrake (which I've long-intended to do, but I just use VideoReDo because it handles my H.264 TS files well).

For the replacing part, that's a separate tool. MCAutoQueue is just a "batch job queue" system for MC.

The MCFileIngester utility (which is part of the download) is the thing that will actually do the "file swap" in MC's Library. You'd put this as the last step in your VBS script (which would be simplified greatly to just handle one single file). MCFileIngester can run on either a Playlist in MC (handling multiple files) or on just two files (a source and a new file, essentially). Watch this video for an example of how it works:
https://vimeo.com/85110224

This example uses Playlists as sources to replace files interactively, and is not for this kind of automation (for which you'd want to handle only a single set of files), but it'll give you the idea.

You could, if you wanted, not use MCAutoQueue at all. You'd just keep using your VBS script as it is (scanning the directory) and use MCFileIngester to handle that last bit. But, MCAutoQueue is pretty cool, and doesn't require regular filesystem scans because it is driven by a Smartlist in MC. So you can filter it with anything you can search for in MC.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #27 on: April 14, 2016, 06:54:46 pm »

I suppose I will also have to add a field that is populated on my recorded TV subscription rules...something like 'To Be Compressed', so that I can pull out the series that I want to compress...I don't compress all files (like 'The Voice').  But it should be a simple matter to add that field and auto populate it in the subscription rules per series.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #28 on: April 14, 2016, 10:19:17 pm »

Yeah. That's basically what I do.

I have a Processor set up in MCAutoQueue called VideoReDo-iPhone. This runs VideoReDo in basically the same configuration as Handbrake's built-in iPad preset.

Most of the shows I want to process with this are part of specific genres, such as: Kids, Game Shows, News, and stuff like that. So, I have rules like this in Tag on Import:


So, I set all the Genres. That's handy for browsing in Theater View sometimes anyway, so I Genre-tag most of my shows scheduled for recording that way. They all follow this pattern:
Genre: If(IsEqual([Series],SHOW_NAME,8),ASSIGNED_GENRE,[Genre])

If I need to "normalize" the series title (because how it records isn't how I want it stored), I first do one to fix that (like the Sesame Street example in my screenshot above). And then set the Genre in the very next rule.

Then, at the very bottom of the Tag on Import rules for that folder, I have:


Which assigns the [Needs Processing] status based on the [Genre] tag of the show. A few other shows get individually added with different Processors (I have another one that just remuxes TS files into MKV files).

If you wanted to process most files instead (except a few individual series), you could set it up backwards. Set it to auto-tag everything with the [Needs Processing] flag (which is easy and doesn't even need an expression), and then turn it off (make [Needs Processing] blank) for the individual series where you don't want it done.

One nice thing about using the individual field like that for [Needs Processing] is that MCAutoQueue will set a resulting status if your script exits with good return values. If the return value of the processor is 0, then MCAutoQueue sets the [Needs Processing] field for that file to "Completed". If the return value is non-zero (or the timeout expires and it is killed) then it sets it to "Failed". So I can look through any files that fail to process and see what went wrong.

Of course, if you only have one Processor, and you don't care about tracking success or failure, you can just make [Needs Processing] a "calculated field" which doesn't really do anything but always returns the same value for every file. Then you just limit which files get processed via your Smartlist, and they always get the same Processor.

There's lots of ways to do it. I tried to make the system extremely flexible.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #29 on: April 16, 2016, 11:33:08 am »

I'm sure it's something simple, but I am getting a 'Processor undefined in config" error.

I added the library field called NeedsProcessing, added the smartlist so that anything that has a number of plays > 0 and has "Compress" in the NeedsProcessing field would be added to the smart list...that works.

I then open MCAutoQue, set the appropriate settings (playlist and field to process), and it sees the smartlist.  The processor is defined as follows:

Processor Key: Compress
Command to Run: C:\Program Files\Handbrake\HandBrakeCLI.exe
Argument: -i "[Filename]" -t 1 --angle 1 --start-at duration:7 -o "T:\TV\[Series]\Season [Season]\[Series] - S[Season]E[Episode] - [Name].mp4" -f mp4  --decomb="bob" -w 854 -l 480 --crop 0:0:0:0 --modulus 2 -e x264 -q 20 -r 29.97 --cfr -a 1 -E av_aac -6 stereo -R Auto -B 320 -D 0 --gain 0 --audio-fallback ac3 --encoder-preset=veryslow  --verbose=1
Update MC: Checked
Timeout: 180 Minutes

This is in the log:

INFO  Connecting to running MC instance...
INFO  Successfully connected to Media Center.
INFO  MC Loaded.  Version: 21.0.66
ERROR Queuing Error: Processor undefined in config:
ERROR Queuing Error: Processor undefined in config:
INFO  Queued File (0): D:\Recorded TV\NCIS - S12E18 - Status Update.ts
INFO  Queued File (1): D:\Recorded TV\Last Man Standing - S05E21 - The Marriage Doctor.ts
ERROR Queue Item Error: One (or more) of the items added to the Queue generated errors.  Check the log for specific details.

Any ideas?  

I just tried Single quotes in the argument, and that also didn't work.
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #30 on: April 16, 2016, 11:37:47 am »

Nevermind...just found it...I had Needs Processing as the library field, and NeedsProcessing in MCAutoQue...Doh!
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #31 on: April 16, 2016, 11:41:40 am »

OK, so still failing...here is why, but no idea how to fix it...

the command argument is being sent as:
Code: [Select]
Argument: -i '"D:\Recorded TV\Last Man Standing - S05E21 - The Marriage Doctor.ts"' -t 1 --angle 1 --start-at duration:7 -o 'T:\TV\"Last Man Standing"\Season 5\"Last Man Standing" - S5E21 - "The Marriage Doctor".mp4' -f mp4  --decomb='bob' -w 854 -l 480 --crop 0:0:0:0 --modulus 2 -e x264 -q 20 -r 29.97 --cfr -a 1 -E av_aac -6 stereo -R Auto -B 320 -D 0 --gain 0 --audio-fallback ac3 --encoder-preset=veryslow  --verbose=1

I can fix the input filename by taking off the quotes in my argument, but not sure how to fix the output filename (-o), since I would like to use the series and name fields in the output filename...would also like season to be padded with a 0, so it is 05, but that is not a huge deal.
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #32 on: April 16, 2016, 11:57:18 am »

I created a calculated field in MC and used that for the output path, so not the argument is being passed as:

-i "D:\Recorded TV\Last Man Standing - S05E21 - The Marriage Doctor.ts" -t 1 --angle 1 --start-at duration:7 -o "T:\TV\Last Man Standing\Season 5\Last Man Standing - S5E21 - The Marriage Doctor.mp4" -f mp4  --decomb="bob" -w 854 -l 480 --crop 0:0:0:0 --modulus 2 -e x264 -q 20 -r 29.97 --cfr -a 1 -E av_aac -6 stereo -R Auto -B 320 -D 0 --gain 0 --audio-fallback ac3 --encoder-preset=veryslow  --verbose=1

but it is still failing...this is the log from the main window:
Code: [Select]
INFO  Connecting to running MC instance...
INFO  Successfully connected to Media Center.
INFO  MC Loaded.  Version: 21.0.66
INFO  Queued File (0): D:\Recorded TV\Last Man Standing - S05E21 - The Marriage Doctor.ts
INFO  Queue Ready.
INFO  Starting Queue Processing...
INFO  Total Queue Items: 1
INFO  Processing Queue Item (1)...
INFO    File: D:\Recorded TV\Last Man Standing - S05E21 - The Marriage Doctor.ts
INFO    Command: C:\Program Files\Handbrake\HandBrakeCLI.exe
INFO    Argument: -i "D:\Recorded TV\Last Man Standing - S05E21 - The Marriage Doctor.ts" -t 1 --angle 1 --start-at duration:7 -o "T:\TV\Last Man Standing\Season 5\Last Man Standing - S5E21 - The Marriage Doctor.mp4" -f mp4  --decomb="bob" -w 854 -l 480 --crop 0:0:0:0 --modulus 2 -e x264 -q 20 -r 29.97 --cfr -a 1 -E av_aac -6 stereo -R Auto -B 320 -D 0 --gain 0 --audio-fallback ac3 --encoder-preset=veryslow  --verbose=1
INFO    Timeout: 03:00:00
ERROR Queue Worker (1) Failed.  Exit Code: 3
WARN  Queue Completed, but one or more items Failed.
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #33 on: April 16, 2016, 12:03:46 pm »

OK...talk about a weird one...I recreated the exact command (with quotes around the path to the actual .exe) in a batch file, and it failed as well...however, when trying to process a different file, it all works fine.

So, I am running a show (NCIS) through the process, and will see how it handles my settings.
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #34 on: April 16, 2016, 02:17:46 pm »

OK...so I think I finally found something that I can't figure out (of course I will keep thinking)...Handbrake errors out if the path isn't there (it won't create it for you), which is why my first attempt failed, but NCIS worked just fine.

Is there a way to run a sequence of commands in MCAutoQue?  I was thinking that I could just do a simple mkdir [Filename(Path)] prior to running handbrake (although it would return an error if the path does exist).  

Any suggestions?

EDIT:

1 more thing: I am passing this from MCAutoQue to MCFileIngester:

Code: [Select]
MCFileIngester.exe --autorun --autoexit -m:Standard -n:"T:\TV\Last Man Standing\Season 05\Last Man Standing - S05E21 - The Marriage Doctor.mp4" -t:Replace --deletesource -s:"D:\Recorded TV\Last Man Standing - S05E21 - The Marriage Doctor.ts"
In MCAutoQue, it is actually:
Code: [Select]
-m:Standard -t:Replace -s:[Filename] -n:[PathForAutoQue] -deletesource
and I am running it on the Processor Key Complete (although I tried ReImport just in case the key word was messing it up).

It doesn't appear to work running from MCAutoQue (it just kinda hangs, waiting for the 5 minute time out, but never actually does anything), however, if I paste the same exact code into a command prompt, it works fine.
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #35 on: April 16, 2016, 04:40:53 pm »

OK...think I got it all now.  I had to explicitly add some of the command line arguments, and then it worked.
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #36 on: April 16, 2016, 10:45:30 pm »

So the only thing I haven't figured out yet (I think) is if it is possible to create the directory for the compressed file.  I believe that would take 2 commands for each processor (1 would be a mkdir, and the other the handbrakeCLI.exe command).  other than that, I have it working great.  If it is not possible, then I guess whenever I start a new series subscription or new season of an existing series, I will have to manually create the folder. 

I used 2 smart lists, one based on 'Needs Processing' being set to 'Compress', which runs Handbrake on the file (and will run via the task scheduler at 12:05 AM), and the other with the value being set to 'Completed', which will run the file ingester at 8AM.  Other than the above, it appears to all be working great.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #37 on: April 17, 2016, 09:42:38 am »

So the only thing I haven't figured out yet (I think) is if it is possible to create the directory for the compressed file.  I believe that would take 2 commands for each processor (1 would be a mkdir, and the other the handbrakeCLI.exe command).  other than that, I have it working great.  If it is not possible, then I guess whenever I start a new series subscription or new season of an existing series, I will have to manually create the folder.

Sorry. I've been frantically packing and trying to move, so I didn't have time to respond previously. (I don't have much time now, and should really be working, but I'm taking a break.)

There's no built-in way to do more than one command with a single Processor. It is designed assuming that the processor you use would be a script. So, your script would:

1. Check for the existence of the output directory and create it if needed (this would be simple with a vb script using the Scripting.FileSystemObject you used in the previous incarnation).

2. Run the HandbrakeCLI command you want run on the source.

3. Wait for that process to finish and check to see if it completed successfully (return value of 0 on the HandbrakeCLI command). You can do this in a vb script with the WshShell.Run command by setting the bWaitOnReturn value to True. There's an example here that shows how to launch Notepad.exe and wait for it to be closed, and then save the return value.

4. Run MCFileIngester and replace the original source with the newly created copy in MC's Library (optionally deleting the original source file as desired).

You could hack it together by using separate processors, I suppose, but that isn't really how it is designed.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #38 on: April 21, 2016, 07:20:17 pm »

Every once in a while I have a file fail to compress using handbrake (I end up with a 0 byte file...this really never happened before using the VBS script)...it has happened 3 times.  Is it possible that MC is trying to import the file prior to it being finished compressing and causing issues?  The only difference in actual work between using MCAutoQue and my script is that I am writing the new file into it's final destination.  It would not be a big deal to change it so that it writes to a different location and then moves it, but I don't want to do that if that isn't actually the issue...

any ideas?
Logged

muzicman0

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1239
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #39 on: April 22, 2016, 09:38:55 am »

Everytime I think I get stuck, right after I post, I get it figured out.  I was using the 'name' of the episode in the output file name for Handbrake, where before I was using the file name.  At least 2 of the 3 problem files (and possibly all 3) had colons in their name, but underscores in the file name.  I simply changed the library field I am using to filename (name) instead of name, and that should work...it will end with '.ts.mp4', but that is an acceptable tradeoff.  I'm sure I could figure out a way to strip out the colons, but sometimes simplicity is the better option!
Logged

CountryBumkin

  • Citizen of the Universe
  • *****
  • Posts: 3352
Re: Decompress large video files on the fly, and view in JRiver.
« Reply #40 on: April 22, 2016, 10:55:24 am »

Sorry. I've been frantically packing and trying to move, so I didn't have time to respond previously. (I don't have much time now, and should really be working, but I'm taking a break.)


Do you need us to send a couple of guys over to help with the moving? We need you here.  ;D
Logged
Pages: [1]   Go Up