NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Windows v
« Previous 1 … 21 22 23 24 25 … 101 Next »
Post Record action advice?

 
  • 0 Vote(s) - 0 Average
Post Record action advice?
three6zerocool
Offline

Member

Posts: 236
Threads: 33
Joined: Jul 2019
#1
2023-09-03, 08:44 AM
Hello....  I remember Sub informing me that is possible to create function to perform a post record action.
Been trolling thru old postings, but can't find the particular advice thus far.

Am wondering if recording to a fast drive like an NVME m.2 drive, and then when recording is complete, having it automatically get moved to my NAS is possible?
At one stage, sub suggested a method, where it copies the recording, and then somehow updates the database.

For the most part, my NAS seems to work admirably, but at times when NAS is performing Maintenace tasks, I find that a bit of weirdness like stutter happens until the NAS catches up.
Thinking of Sub's suggestion from that time.

..cheers..
three6zerocool
Offline

Member

Posts: 236
Threads: 33
Joined: Jul 2019
#2
2023-09-03, 10:33 AM
I found Sub's suggestion to me regarding copying completed recordings to NAS.

Not sure what I am doing tho,  but will check it out, and have downloaded the sample windows script templates mentioned in the Wiki.

My NAS (TrueNAS) is pretty fast, and uses 2.5gbit to the NextPVR server, but on occasion the NAS performs routine Maintenance, such as scrub tasks etc, and this seem to cause some stutters for a time with my recordings.
(kinda dependent how many shows are recording simultaneously, and if I am watching live tv at the time)
(The NAS is quite large, so these maintence tasks can run for a long time, sometimes several hours to a day.)

I have spare NVME drive, so was thinking about having it as a temporary recording drive, and then on completion of recording, move to NAS, and see if it improves performance over my current configuration.
From reading postings of others recording to NAS, it speaks of pixelization etc, which is what I have experienced.


I also tried setting NAS as timeshift location, but seemed to not work that great at the time.

Would appreciate any script assistance, but I understand ops don't get involved in such things, which is understandable.

' If the user creates a PostProcessing.bat file, this will be run automatically at the end of each recording. In that batch file, the user could move the file to another location, and maybe run "NScriptHelper -rename x y" to have NextPVR update it's database.'
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,661
Threads: 767
Joined: Nov 2003
#3
2023-09-03, 07:34 PM
I'd give you some tips on this, but I'm terrible at writing batch files. Sorry!

Basically your batch file is going to move the file from the source location (%1 parameter) to whatever target directory you want to use, then call that "NScriptHelper -rename x y" so the NextPVR database knows where you've moved it to.

The tricky bit is coming up with the batch file commands to construct the target directory name (which presumably would need to be extracted from part of %1).
gEd
Offline

Posting Freak

London
Posts: 3,514
Threads: 100
Joined: Jan 2005
#4
2023-09-04, 09:27 PM
If you move your recordings to a NAS, make sure you have these set
<AutoRemoveMissingRecordings>false</AutoRemoveMissingRecordings>
<NoRemoveWhenTreeMissing>true</NoRemoveWhenTreeMissing>  
to prevent NPVR from deleting all of your recordings from the database if you NAS goes offline.

I cobbled this postprocessing.bat together from the original nscript here: https://forums.nextpvr.com/showthread.ph...t=robocopy
you will need to change several values to make it work in your setup and you will want to test it on some recordings that you don't mind losing in case it doesn't work correctly for you.
(I've tested it here and it seems to work fine but I haven't tested what happens if the existing recording file is in use)

Code:
@Echo Off
Rem to understand what these filename shortcuts like  %~dp1 mean, read this webpage https://superuser.com/questions/224416/what-do-df0-and-df1-mean-in-a-batch-file

set source=%1
set title=%2
set sourcePath=%~dp1
set filename=%~n1

Rem Change S: to the new location where you want the recording to be moved to. FOr network devices use UNC format \\servername\sharedfolder
set destPath=S:%~p1
set dest=%destPath%%filename%%~x1

Rem Location of log file
set log=R:\temp\MoveRecordings.log

echo ================================================================================ >> %log%
echo Post Processing started on %date% %time% for %title% >> %log%
echo Source File=%source% >> %log%
echo Destination Folder=%destPath% >> %log%
echo Post Processing started on %date% %time% for %title%
echo Source File=%source%
echo Destination Folder=%destPath%

rem this command used .* on the end to copy the additional (hidden) timinginfo and thumbnail files (google Alternate Data Streams if you're curious)
echo xcopy %sourcePath%%filename%.* %destPath% /z /j /y /i /h >> %log%
xcopy "%sourcePath%%filename%.*" "%destPath%" /z /j /y /i /h

Rem when testing, it can be helpful to run the script interactively by dragging a recording onto this bat file in which case
Rem uncomment the following command (by removing "Rem")
rem pause

if %errorlevel% equ 0 GOTO :OK
GOTO :ERROR
:OK

Rem for guidance on use of Nscripthelper, see the wiki page: https://github.com/sub3/NextPVR/wiki/nscripthelper
Echo Running nScript helper to rename %source% to "%dest%" >> %log%
Echo Running nScript helper to rename %source% to "%dest%"
"c:\program files\nextpvr\nscripthelper.exe" -pin:XXXX -rename %source% "%dest%"

echo Successful Copy, deleting source file: "%sourcePath%%filename%.*" >> %log%
echo Successful Copy, deleting source file: "%sourcePath%%filename%.*"
del "%sourcePath%%filename%.*"

rem pause

goto :EOF
:ERROR

echo Error when copying %source% error was: %errorlevel%
GOTO :EOF

:EOF
echo End Processing of %source% >> %log%
“If this is the way Queen Victoria treats her prisoners, she doesn't deserve to have any.”
three6zerocool
Offline

Member

Posts: 236
Threads: 33
Joined: Jul 2019
#5
2023-09-05, 02:09 AM
Thankyou oh so much for this, that is really decent of you.  I appreciate it a lot.

I currently record to the NAS, and the path I use in NextPVR settings is '\\TRUENAS\TV Recordings' 
Will back up the system and NextPVR database and files and have an experiment.

Thankyou one again for your kindness and knowledge.
gEd
Offline

Posting Freak

London
Posts: 3,514
Threads: 100
Joined: Jan 2005
#6
2023-09-05, 09:19 PM
(2023-09-05, 02:09 AM)three6zerocool Wrote: Thankyou oh so much for this, that is really decent of you.  I appreciate it a lot.

I currently record to the NAS, and the path I use in NextPVR settings is '\\TRUENAS\TV Recordings' 
Will back up the system and NextPVR database and files and have an experiment.

Thankyou one again for your kindness and knowledge.

Thank me when it works! (you've very welcome)

the path I use in NextPVR settings is '\\TRUENAS\TV Recordings' 
I just tested it with a destination folder that contains a space and it seems to work fine. 
Just keep in mind that how it works at the moment is that it copies the entire folder name minus the driver letter. so if the existing recording is on c:\TV Recordings\show_name and you want the destination will end up as \\TRUENAS\TV Recordings\show_name set set destPath=\\TRUENAS \%~p1.

Another tip, just name the batch file as test.bat for the moment and drag a test recording onto it to check that it moves all the files to the right place and updates the database correctly (test playback with whatever NPVR client you use).
In that way, it won't get run automatically by NextPVR while your testing. Once you happy with it, rename test.bat to postprocessing,bat

Arguably it would be better to use robocopy instead of xcopy (newer and can tolerate network interruptions and helps resume copy) but I didn't spend time investigating what the command would have to be as I've not used it myself.

good luck
“If this is the way Queen Victoria treats her prisoners, she doesn't deserve to have any.”
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,835
Threads: 954
Joined: May 2006
#7
2023-09-05, 10:00 PM
Personally I'd try and diagnose the problem. I am no sure how much memory and buffering sub allows fro BDA tuners but digital streams even 4 or 5 should not max out a modern network or drives. If anything 4 or 5 simultaneous xcopies will really push your systems especially if that is when the scrubbing is taking place. You might not get the desired results beyond a guaranteed slowdown.

Regarding 2.5Gb networking Linux and Windows are not necessarily working well at that speed. For months I had trouble with my Debian server and it turned out my 2.5Gb Realtek card was delivering 300Mb half duplex because the proper driver was not being detected. It was exactly the same problem solved in this thread. Definitely check you TrueNAS for that cdc_ncm driver.

You might also need to check how thumbnail and timing generation impact post processing to guarantee they finish before the copy. This was never well tested IMO.

Martin
gEd
Offline

Posting Freak

London
Posts: 3,514
Threads: 100
Joined: Jan 2005
#8
2023-09-05, 11:03 PM
With "generate thumbnails after recording" set, NPVR generates the thumbnails before launching postprocessing.
“If this is the way Queen Victoria treats her prisoners, she doesn't deserve to have any.”
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,835
Threads: 954
Joined: May 2006
#9
2023-09-05, 11:08 PM (This post was last modified: 2023-09-05, 11:09 PM by mvallevand.)
What about the default with parallel processing? With post processing thumbnails can stress the system which parallel processing avoids, mostly.

Martin
gEd
Offline

Posting Freak

London
Posts: 3,514
Threads: 100
Joined: Jan 2005
#10
2023-09-05, 11:37 PM
actually, it looks like it calls postprocessing after it has generated thumbnails (with ffmpeg) but it hasn't waited for timinginfo to have been generated (ffprobe).
So I think that's a potential defect as NPVR should have (obviously) finished all of it's processing before calling postprocessing.

I just did a test with parallel processing and the ffmpeg and ffprobe processes appear to end at the same moment that the recording finishes. Whether it will work that way on all PCs I don't know.
(I switched off parallel processing last night after running into the infinite "IsComplete(): An error occurred while parsing EntityName" problem)

[off topic: FYI I happen to have my eyes on this atm as I'm playing around to see if I can successfully resume remuxing my recordings as I'm getting lipsync problems playing back .ts files with UIclient on the TV]
“If this is the way Queen Victoria treats her prisoners, she doesn't deserve to have any.”
« Next Oldest | Next Newest »

Users browsing this thread: 3 Guest(s)

Pages (4): 1 2 3 4 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Won't Record & Won't Forward & Minute Forward Missing suezew 2 67 2025-05-18, 07:36 PM
Last Post: sub
  How to remove multiple record failures bass_gas 1 99 2025-05-13, 03:59 PM
Last Post: mvallevand
  Installed V7 - unable to record. Dave48167 6 287 2025-05-11, 08:02 PM
Last Post: Dave48167
  How many IPTV streams should i be able to record at the same time? sharkbite 6 438 2025-03-27, 01:26 AM
Last Post: sharkbite
Photo NextTVPI and Titan Record Not Working N88yanks 18 681 2025-02-03, 09:21 PM
Last Post: N88yanks
  7.0.1.241229 Back end status stuck in record mode PIPE... eastavin 3 299 2025-01-28, 05:10 PM
Last Post: mvallevand
  7.0.0.241105 Back end status stuck in record mode PIPE... eastavin 1 278 2024-12-11, 10:54 PM
Last Post: Bobins
  NextPVR won't record from Ceton InfinitiTV 6 DavidNYC78 3 526 2024-08-06, 06:11 PM
Last Post: DavidNYC78
  Default action on channel selection? FlT4ever 2 577 2024-04-16, 10:52 AM
Last Post: Estarna
  Every record is terminated early Buckaragua 32 3,991 2024-04-02, 02:03 PM
Last Post: mvallevand

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode