This project has moved. For the latest updates, please go here.

HDHomerun DVR - Leave metadata behind while moving file.

Jan 28, 2016 at 6:26 PM
I am trying to figure out how i can just leave behind the recognizable metadata in the HDHomerun DVR recordings in such a way that it is quick and only takes a minimal space. I have found one way that uses handbrake to cut to 1 frame and leave behind the metadata (i think, it is still "working") but this takes too much time and resources by the pc that it is really not a viable solution. Is there another way i am not seeing? is there a way to use an unprocessed profile to simply cut the file down? Any help would be great.
Coordinator
Jan 28, 2016 at 7:25 PM
Sorry didn't understand the question. You only want metadata?

Jan 28, 2016 at 7:43 PM
Edited Jan 28, 2016 at 7:50 PM
The SD DVR in order to not re record needs to read the metadata in the video files. I want a quick dirty to dump it into the smallest file size possible and have the DVR recognize it so as to not re record. Right now im using the h.264 profile edited to use handbrake to cut down the video file to the first 10 seconds and write in the metadata so that the dvr recognizes it. That way when i am finished with the episode i can delete it. The question is basically, is handbrake the only option to do this? and if so what would be the quickest possible route with the least system resources used? Since i will have to process all new recordings twice, ideally the metadata process would take less time than the initial unprocessed version (i only use it for renaming because the filenames are not always right from the SD DVR)

Current rules are as such.
Rule 1 Path 1 Watching A
Pointed to recording directory. Quickly re names files properly and re organizes them. Deletes original file. SiliconDust Unprocessed profile
Rule 2 Path 2 Watching Path 1
cuts file down to 10 seconds using h.264 Silicondust profile and places it into the record engine directory as to be recognized. requires handbreak which can peg my cpu for a short time (trying to avoid that and make it faster)

the small 10 second clip will never be watched so video quality is not important as long as it has the original metadata contained in the original file so the dvr is faked into thinking it recorded that episode already.
Coordinator
Jan 29, 2016 at 12:15 AM
Use the TS Unprocessed profile and customize it to add the following parameter to the ffmpeg-video line

-t 5

This will keep only 5 seconds of the video in the destination file and it's quick since it's unprocessed.

Jan 29, 2016 at 4:49 AM
rboy1 wrote:
Use the TS Unprocessed profile and customize it to add the following parameter to the ffmpeg-video line -t 5 This will keep only 5 seconds of the video in the destination file and it's quick since it's unprocessed.
TS unprocessed or the HDHomerun Unprocessed (to preserve metadata) ?
Jan 29, 2016 at 7:41 AM
I tried it like this:

[HDHomeRun Unprocessed Short]
Description=Used to remove commercials and create a SiliconDust HDHomeRun compatible MPG file while keeping original video/audio quality and format. It does not remove black bars, resize the video, deinterlace or select audio language.
order=copy,ffmpeg
copy-ext=.ts
copy-audiodelay=skip
ffmpeg-general=-threads 0
ffmpeg-video=--t 5
ffmpeg-audio=-acodec copy -map 0:a
ffmpeg-audioac3=-acodec copy -map 0:a
ffmpeg-ext=.ts
ffmpeg-audiodelay=skip
FixedResolution=true
SkipCropping=true
PreConversionCommercialRemover=true
RenameExt=.mpg


and i tried it like this

[HDHomeRun Unprocessed Short]
Description=Used to remove commercials and create a SiliconDust HDHomeRun compatible MPG file while keeping original video/audio quality and format. It does not remove black bars, resize the video, deinterlace or select audio language.
order=copy,ffmpeg
copy-ext=.ts
copy-audiodelay=skip
ffmpeg-general=-threads 0
ffmpeg-video=-vcodec copy -f mpegts -map 0:v -sn -t 5
ffmpeg-audio=-acodec copy -map 0:a
ffmpeg-audioac3=-acodec copy -map 0:a
ffmpeg-ext=.ts
ffmpeg-audiodelay=skip
FixedResolution=true
SkipCropping=true
PreConversionCommercialRemover=true
RenameExt=.mpg


Both ways i ended up with original file size.... i dont see a difference between this and ts unprocessed... what am i doing wrong exactly??
Coordinator
Jan 29, 2016 at 12:25 PM
The second one is correct but don't use the copy encoder. It's just copies the file as it. Only use ffmpeg. Change your order to only ffmpeg.

Jan 29, 2016 at 4:09 PM
rboy1 wrote:
The second one is correct but don't use the copy encoder. It's just copies the file as it. Only use ffmpeg. Change your order to only ffmpeg.
have trouble here. failing. It goes through the motions then nothing no new file in the new location and i am not quite sure what i should be looking for here. 3 logs from 3 test files

Log1

Log2

Log3

thank you for your time and assistance on this matter by the way
Jan 29, 2016 at 6:09 PM
+1
I haven't tried this yet, but it would be really cool to have an optimized profile that leaves a "phantom" file with basically only metadata, so that we HDHR-DVR users could delete (or move) recordings and not trigger the HDHR-DVR to re-record/replace those deleted files.
That said, SiliconDust should fix this before their product goes commercial. It's absolutely asinine that we can't delete (or move/archive) shows we've watched, so I have confidence that this will be fixed, it's just low priority on their to-do list right now.
So a work-around via MCEBuddy would be sweet for the interim.
:)
Jan 29, 2016 at 6:11 PM
KieranC wrote:
+1
I haven't tried this yet, but it would be really cool to have an optimized profile that leaves a "phantom" file with basically only metadata, so that we HDHR-DVR users could delete (or move) recordings and not trigger the HDHR-DVR to re-record/replace those deleted files.
That said, SiliconDust should fix this before their product goes commercial. It's absolutely asinine that we can't delete (or move/archive) shows we've watched, so I have confidence that this will be fixed, it's just low priority on their to-do list right now.
So a work-around via MCEBuddy would be sweet for the interim.
:)
SD has said they intend to be able to delete episodes from within THEIR client/app so for me it will always be a problem as they dont intend on making it so you can just delete from the drive/folder/move without triggering a re record
Jan 29, 2016 at 6:17 PM
AMDunderused wrote:
SD has said they intend to be able to delete episodes from within THEIR client/app so for me it will always be a problem as they dont intend on making it so you can just delete from the drive/folder/move without triggering a re record
Fair enough. Either way, it would be great for now, to get a working MCEBuddy profile that solves this problem for those of us who like to watch our content via other MC apps like Plex or Kodi.
Coordinator
Jan 29, 2016 at 7:03 PM
I asked you to use
-t 5

you entered
--t 5

Jan 29, 2016 at 7:14 PM
rboy1 wrote:
I asked you to use -t 5 you entered --t 5
Ahh, so i did! lol sorry was doing this laying in bed about 14 feet away from my 42" tv and had not noticed the error glad you caught it :D running tests again.

Again THANKS.
Coordinator
Jan 29, 2016 at 7:17 PM
Edited Jan 29, 2016 at 7:17 PM
KieranC wrote:
+1
I haven't tried this yet, but it would be really cool to have an optimized profile that leaves a "phantom" file with basically only metadata, so that we HDHR-DVR users could delete (or move) recordings and not trigger the HDHR-DVR to re-record/replace those deleted files.
That said, SiliconDust should fix this before their product goes commercial. It's absolutely asinine that we can't delete (or move/archive) shows we've watched, so I have confidence that this will be fixed, it's just low priority on their to-do list right now.
So a work-around via MCEBuddy would be sweet for the interim.
:)
Too specific for MCEBuddy to address, this needs to be fixed by SD. However having said that there's a MUCH simpler solution. In the HDHR profile add a PostCustomCommand to it. Call a batch file in the post custom command.
In the batch file use the original file variable, destination path to copy the first 100K bytes from the original file to the destination folder.

Use this FileCopy program to achieve the above.
http://www.softtree.com/24x7/archive/44.shtml
Coordinator
Jan 29, 2016 at 7:26 PM
Put this in the profile:
PostCustomCommandPath=C:\SDCopy\SDCopy.bat
PostCustomCommandParameters="%sourcefile%" "%destinationpath%\%originalfilename%.%originalext%"
PostCustomCommandHangPeriod=600
PostCustomCommandCritical=true
PostCustomCommandUISession=false
PostCustomCommandShowWindow=false
PostCustomCommandExitCodeCheck=false
Copy FileCopy.exe to C:\SDCopy and create a Batch file SDCopy.bat in the same directory with the following contents:
C:\SDCopy\FileCopy.exe %1 %2 /L 100000
http://www.softtree.com/24x7/extras/FileCopy.exe
Jan 29, 2016 at 7:28 PM
Edited Jan 29, 2016 at 7:30 PM
edit you answered going to try this out
Jan 29, 2016 at 7:32 PM
will those parameters work when deleting original file is being used and moving renamed file?
Coordinator
Jan 29, 2016 at 7:34 PM
Yes all the source file alternations are done AFTER the conversion task is over, CustomCommands are executed at various points during the conversion task. See the documentation for details

Jan 29, 2016 at 7:44 PM
so far ran it on 2 files and not seeing any 100k file being put anywhere what did i do wrong here i laid it out just like you said made the SDCopy.bat put the custom commands in profile

this is how the profile looks now..
[HDHomeRun Unprocessed]
Description=Used to remove commercials and create a SiliconDust HDHomeRun compatible MPG file while keeping original video/audio quality and format. It does not remove black bars, resize the video, deinterlace or select audio language.
order=copy,ffmpeg
copy-ext=.ts
copy-audiodelay=skip
ffmpeg-general=-threads 0
ffmpeg-video=-vcodec copy -f mpegts -map 0:v -sn
ffmpeg-audio=-acodec copy -map 0:a
ffmpeg-audioac3=-acodec copy -map 0:a
ffmpeg-ext=.ts
ffmpeg-audiodelay=skip
FixedResolution=true
SkipCropping=true
PreConversionCommercialRemover=true
RenameExt=.mpg
PostCustomCommandPath=C:\SDCopy\SDCopy.bat
PostCustomCommandParameters="%sourcefile%" "%destinationpath%\%originalfilename%.%originalext%"
PostCustomCommandHangPeriod=600
PostCustomCommandCritical=true
PostCustomCommandUISession=false
PostCustomCommandShowWindow=false
PostCustomCommandExitCodeCheck=false
Coordinator
Jan 29, 2016 at 7:45 PM
That's just to get you started, go through the log file and see what's going on.

Jan 29, 2016 at 7:54 PM
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> Launching process c:\sdcopy\sdcopy.bat
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> Process arguments B:\Sofia the First\Sofia the First 3-03 20151106 [20160129-1830].mpg" "B:\Sofia the First\Sofia the First\Season 03\Sofia the First 3-03 20151106 [20160129-1830].mpg
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> UI Session Admin Process : False
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> Setting process priority to Normal
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> c:\sdcopy>C:\SDCopy\FileCopy.exe B:\Sofia the /L 100000
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> Non-locking FileCopy version 1.01
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> Copyright (c) 2002 SoftTree Technologies, Inc.
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> Start position: 0, file size: -1
2016-01-29T14:38:20 MCEBuddy.AppWrapper.Base --> Start position beyond file end!
--> Process exited with code 3

not sure what went wrong or what it means.
Coordinator
Jan 29, 2016 at 8:45 PM
> C:\SDCopy\FileCopy.exe B:\Sofia the /L 100000

The filename aren't being passed to your batch file correctly. Probably a mistake in your profile.

> Process arguments B:\Sofia the First\Sofia the First 3-03 20151106 [20160129-1830].mpg" "B:\Sofia the First\Sofia the First\Season 03\Sofia the First 3-03 20151106 [20160129-1830].mpg

You're missing quotes somewhere.

Jan 29, 2016 at 8:53 PM
The profile is directly above, copied and pasted set up exactly as you put it. I have checked quotes to make sure i didnt lose one from copying and it is all identical. i have tried moving the /s position ive increased the length /l to 5MB i checked and re checked that i copied exactly as you put it and the limited detail about filecopy.exe i have checked. I was really interested in this idea as a quicker/easier means to get this done right.
Coordinator
Jan 29, 2016 at 9:22 PM
Edited Jan 31, 2016 at 1:51 PM
Hmm okay so there was a bug in filecopy and a missing quote in the profile above. Use this instead (tried it and it works).

Modify your profile to include this:
PostCustomCommandPath=C:\PartCopy\PartCopy.exe
PostCustomCommandParameters=""%sourcefile%" "%originalfilepath%\%originalfilename%.%originalext%" 0d 100000d"
PostCustomCommandHangPeriod=600
PostCustomCommandCritical=true
PostCustomCommandUISession=false
PostCustomCommandShowWindow=false
PostCustomCommandExitCodeCheck=false
the 0d indicates start from the 0 (decimal) position and 100000d indicates copy the first 100K bytes (decimal).

Create a folder called "C:\PartCopy" and download PartCopy.exe from here and put it in that folder (it comes in a zip file to unzip the exe file)
https://www.virtualobjectives.com.au/utilitiesprogs/PartCopy_v1.12.1.3.zip

You can get help by using PartCopy /? in the command prompt on this tool.
Marked as answer by rboy1 on 1/29/2016 at 2:22 PM
Jan 29, 2016 at 10:06 PM
Got it working thanks! had to change %destinationpath% because it wouldnt allow the 100KB file to end up there it kept trying to put it in the path where the new file was going instead of staying in the hdhr directory. But i got it finished working right would %originalpath% be a variable possible to use? currently i just have it going into a folder in the record directory.
Coordinator
Jan 31, 2016 at 1:54 PM
Yes you can use %originalfilepath% instead of destination above. You can also use %sourcefile% instead of %originalfilepath%\%originalfilename%.%originalext%
They both end up as the same thing. So it looks like you want to replace your source file with a stub 98K of the itself.
Coordinator
Jan 31, 2016 at 2:01 PM
This is a good thread, I've made a sticky out of it. Thanks!
Feb 1, 2016 at 7:15 AM
rboy1 wrote:
This is a good thread, I've made a sticky out of it. Thanks!
Thank You for all the help! Glad it got stickied. It would not be difficult to include the dependency (partcopy.exe) and add this as a 3rd HDHomerun profile either :D

Either way im happy and have helped a few people on SD forums thank you.
Feb 1, 2016 at 8:03 AM
Question. If the 98KB Snippet ends up in a monitored path will it re trigger a conversion?
I personally dont have the record directory monitored at the root but rather each series is monitored for custom folder placement kids/movies/grown up tv so i am able to put the snippets into a non monitored location. also (testing tomorrow) does your custom file naming system work as the variables for setting the path so would "B:\SDDVR\MetaData\%showname%\%originalfilename%.%originalext% " Work as well?
Coordinator
Feb 4, 2016 at 1:03 PM
If the full path including root and file name are identical to the original full path and name then it won't get re monitored. Else it will

May 16, 2016 at 12:56 AM
I have been using MCEBuddy for several weeks in conjunction with the SiliconDust (SD) DVR project. It has been awesome to be able to automate a routine which easily and quickly removes commercials and archives original recordings.

The part that is missing is being able to ensure that the SD DVR doesn't re record shows. You and AMDunderused have programmed an excellent solution, however it is a bit beyond my capabilities (and I'm sure that of many other SD DVR users, current and future).

If you could add a 3rd preset for HDHomeRun recordings as per suggestion by AMDunderused to automatically setup the small, dummy file, I am sure that we can get many more users for MCEBuddy. Combination of the two parts would solve two major user complaints, ff through commercials and re records (or having to complete a 3 step process within the program for every single file to ensure non re record).

Anything you can do to adding this important feature would be much appreciated.
Coordinator
May 16, 2016 at 1:37 AM
If you're using any of the HdHR profiles and your source is a HDHR file the output file will contain the exact same metadata as the original file. I don't see any issue here unless I'm missing something

May 16, 2016 at 2:07 AM
Many of us don't use HDHomerun program to delete files. It requires a 3 step process on every single file, no mass delete. Not really a problem if you watch via HDHR VIEW and then delete right after watching, however:

Many are using other programs to view the recordings and then doing a delete via that program right after viewing or later after all users have watched or mass delete on pc/mac. Hence shows are subject to re record as SD DVR hasn't written a record to the db (via the above 3 step sanctioned delete process) to indicate that show is not to be re recorded.
Coordinator
May 16, 2016 at 3:25 PM
I still don't get it, the converted file has the metadata in it. So you want a stub of the original file left behind is what you're saying?

May 16, 2016 at 3:55 PM
Exactly. The SD DVR will see the stub so it will not re record.
Coordinator
May 16, 2016 at 5:19 PM
Edited May 16, 2016 at 7:39 PM
You can write a post custom command to run a file splitter and cut the first XXX bytes and leave it behind, I have answered this post above some time ago along with the scripts.
Coordinator
May 16, 2016 at 8:09 PM
Jun 5, 2016 at 2:10 AM
I made the below profile that I worked out from this thread. It makes a 5 second clip of the show starting from 5 second point. It's more or less fast, and I'm testing if it works.
[HDHomeRun Phantom]
Description=Used to place a phantom file to prevent re-records
order=ffmpeg 
copy-ext=.ts 
copy-audiodelay=skip 
ffmpeg-general=-threads 0 
ffmpeg-video=-ss 5 -t 5 -vcodec copy -f mpegts -map 0:v -sn
ffmpeg-audio=-acodec copy -map 0:a 
ffmpeg-audioac3=-acodec copy -map 0:a 
ffmpeg-ext=.ts 
ffmpeg-audiodelay=skip 
FixedResolution=true 
SkipCropping=true 
PreConversionCommercialRemover=false
RenameExt=.mpg