Jump to content

task to re-mux ts files post-recording


kamakamadaun

Recommended Posts

Hi,

 

I am trying to use a task to re-mux my recorded ts files to mkv as soon as the recording stops but I haven't been able to make it work.

 

The reason I want to do this twofold. 1) the recorder seems to record some invalid data at the start of the stream (I assume it might be starting to record the stream before a key frame or something like that). This seem to create problems for chromecast sometimes. 2) I can make other programs only look for the mkv files, so that for example Plex won't try to sync files that are still recording.

 

 

So in the task I set:

 

image.png.89368fee2206186e78b0d8c836aee973.png

 

Z: is a network drive. The recording service runs as my own user to be able to access the network drive.

 

The script I have made is then.

@echo off
@echo %1 > test.txt
@echo %2 >> test.txt
@echo %3 >> test.txt
@echo %~1 >> test.txt
@echo "%~1\ffmpeg.exe" >> test.txt

"%~1\ffmpeg.exe" -i %2 -vcodec copy -acodec copy -f matroska "temp.mkv_temp" && copy "temp.mkv_temp" %3.mkv && del "temp.mkv_temp"

 

The first lines were to debug. The script works if I invoke it manually. 

I also tried to make a one-liner to put in the parameters but failed at that too. 

 

When used for the task I don't even get the debug file.

The log says "CreateProcess Error 2". What would that mean?

 

Log:

07.07.18 23:10:00.717 TRecording ($03E16D20)    \\ds412\DS412\Recorded TV\Deadline\2018-07-07_22-25-03_Deadline.ts Discontinuities: 0  -  Total size: 2.43 GB  -  Device:Hauppauge WinTV-dualHD DVBC Tuner 2 (1)
07.07.18 23:10:01.490 TRecording           Release          Hauppauge WinTV-dualHD DVBC Tuner 2 (1)
07.07.18 23:10:01.490 TRecording           Free             Hauppauge WinTV-dualHD DVBC Tuner 2 (1)
07.07.18 23:10:01.763 TRecording           Freed            Hauppauge WinTV-dualHD DVBC Tuner 2 (1)
07.07.18 23:10:01.763 TRecording           hamDeleted       Hauppauge WinTV-dualHD DVBC Tuner 2 (1)
07.07.18 23:10:01.795 ReleaseStandbyblock  TRecording
07.07.18 23:10:01.795 TRecordingEngine     ReleaseReference TRecording: 0
07.07.18 23:10:01.795 TProcessTimer        Process Params   "C:\Program Files (x86)\DVBViewer\" "\\ds412\DS412\Recorded TV\Deadline\2018-07-07_22-25-03_Deadline.ts" "\\ds412\DS412\Recorded TV\Deadline\2018-07-07_22-25-03_Deadline"
07.07.18 23:10:01.795 SetStandbyBlock      TProcessTimer
07.07.18 23:10:01.795 TRecordingEngine     AddReference     TProcessTimer: 1
07.07.18 23:10:01.795 TWinApp              Execute          Z:\Recorded TV\post_rec_convert.bat
07.07.18 23:10:01.795 TWinApp              Working Directory Z:\Recorded TV\
07.07.18 23:10:01.795 TWinApp              CreateProcess Error 2
07.07.18 23:10:01.810 ReleaseStandbyblock  TProcessTimer
07.07.18 23:10:01.810 TRecordingEngine     ReleaseReference TProcessTimer: 0

 

 

Thanks in advance for any hints.

 

 

 

 

 

 

 

 

Link to comment
8 hours ago, kamakamadaun said:

The log says "CreateProcess Error 2". What would that mean?

 

File not found. Maybe this will help:

 

https://stackoverflow.com/questions/2763271/service-not-able-to-access-a-mapped-drive

 

The Recording Service is using the CreateProcess API for task execution.

 

Quote

The recording service runs as my own user to be able to access the network drive.

 

This doesn't mean that the service is running in the user account and can access all its resources. It only shares the logon data with this account.

 

For optionally executing tasks in the active user account (with CreateProcessAsUser) you would need the DVBViewer Media Server.

 

Link to comment

Thanks for the explanation! Very helpful.

 

Apparently the user that executes the command (SYSTEM?) can access the folder if I change to UNC paths (as suggested in your link) in the task setup. So it works now.

 

Thanks again!

Link to comment

For anyone  finding this the script that works is this:

 

@echo off

set "tempFile=%RANDOM%.temp"

"%~1\ffmpeg.exe" -i %2 -map 0 -c copy -f matroska %tempFile%
copy %tempFile% %3.mkv
del %tempFile%


 

Link to comment
×
×
  • Create New...