Tvheadend post recording scripts » History » Revision 3
« Previous |
Revision 3/13
(diff)
| Next »
Hein Rigolo, 2010-03-07 12:55
reformat post recording variables
= Post recording scripts =
On this page you can find a number of (proposed) post recording scripts that you could use to process the Tvheadend recording.
In the DVR configuration page you can specify a "Post-processor command". This can be reference to any program/script that tvheadend will run after the recording has been finished. In order to make it possible to give the program/script some information about the recording that has just finished you can use some variables to build up the actual command that will be executed. Here is the extract from the Tvheadend help page:
'''Post-processor command'''
Command to run after finishing a recording. The command will be run in background and is executed even if a recording is aborted or an error occurred. Use the %e error formatting string to check for errors, the error string is empty if recording finished successfully.
{{{
Support format strings:
Format Description Example value
%f Full path to recording /home/user/Videos/News.mkv
%b Basename of recording News.mkv
%c Channel name BBC world
%C Who created this recording user
%t Program title News
%c Program description News and stories...
%S Start time stamp of recording, UNIX epoch 1224421200
%E Stop time stamp of recording, UNIX epoch 1224426600
}}}
Example usage: /path/to/ffmpeg -i %f -vcodec libx264 -acodec copy "/path/with white space/%b"
You need to use quotes or escape white spaces if you want white spaces in an argument.
The post-processor command can be used to start anything, like in the example about you could use it to transcode the recording to an other format, or anything else you would like. Here we will list some options. Some are complete scripts, others are just thoughts that need to be worked out further.
=== Commercial Flagging ===
[[span('''Work in Progress''', style=color: red; font-size: 100%)]]
Tvheadend does not have it's own build in commercial flagging tool. This was done on purpose because Tvheadend wants to concentrate on the recording and streaming side and leave any post processing to applications/scripts that are much better at this. This means that in order to detect and possibly remove commercials you will need to use seperate programs.
One of the most known commercial detection programs is the one included with MythTV: mythcommflag. This program can also be run as a stand alone tool to detect and flag commercials in valid MPEG files. At the moment Tvheadend does not record directly to MPEG, but it is using the MKV container.
A possible be script would do these steps: * recode the MKV to a MPEG-TS file * Flag commercials to a cut list * remove the suggested frames from the mpeg-ts
flagging the commercials using mythcommflag could possibly be done like this: * use the "--file filename" option to point to the mpeg file * use the "--gencutlist" option to generate a new cutlist for the file * use the undocumented "--outputfile FILE " option to dump the cutlist to a file
removing the commercials from the file could posisbly be done by mythtranscode. This needs further investigation, because it looks that mythtranscode does not have an option to specify a cutlist from a file. It expects the cutlist to be available in the mythtv database (which we do not have ofcourse)
Updated by Hein Rigolo almost 15 years ago · 3 revisions