NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Wishlist v
« Previous 1 … 14 15 16 17 18 … 193 Next »
converting .ts files

 
  • 0 Vote(s) - 0 Average
converting .ts files
ldenorio
Offline

Junior Member

Posts: 1
Threads: 1
Joined: May 2017
#1
2017-05-19, 11:30 AM
would love to have an option to have software automatically convert recorded ts file to mpeg
wintv8 does this but i prefer using nextpvr because it can record new series, but i am having issues using videostream casting to chromecast with .ts file, cant skip ahead or go back
thanks
snagglewest
Offline

Senior Member

VA USA
Posts: 361
Threads: 60
Joined: Jul 2011
#2
2017-05-19, 01:27 PM
Many here use MCBuddy
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,920
Threads: 956
Joined: May 2006
#3
2017-05-19, 02:05 PM
Videostream is already transcoding which is why you can't skip How do you play the WinTV files?

Martin
SteveTyrakowski
Offline

Member

Posts: 142
Threads: 26
Joined: Dec 2004
#4
2017-05-31, 05:25 PM
ldenorio Wrote:would love to have an option to have software automatically convert recorded ts file to mpeg
wintv8 does this but i prefer using nextpvr because it can record new series, but i am having issues using videostream casting to chromecast with .ts file, cant skip ahead or go back
thanks

I use a semi-complex setup to automatically convert all my .ts files to .mp4. I have written a Delphi application that looks at the npvr.db3 database and gets a sorted list of any .ts files in the database with the oldest first. The program then copies that file to a special directory where it will get converted to .mp4. This is something that could be done using MCEBuddy, but I had some problems with that losing the audio on some recordings.

What I have now is a separate Linux box where I copy the file to, and a cron job looks for a new file then runs a script that calls Handbrake command line to convert it to .mp4 and deletes the .ts file when done. The missing .ts file is the signal for my Delphi program to copy the .mp4 file to the NPVR video directory and then update the NPVR.DB3 database with the new filename and then deletes the .ts file.

The .mp4 files end up taking between 10 and 20% of the size of the .ts file so it greatly improves my storage of them.

I use a separate Linux box to offload the overhead of the file conversion so it doesn't affect my NPVR box which might be recording 4 shows simultaneously. There is however a Windows command line version of Handbrake that could be run on the same box.

All in all it works pretty well and is fairly automatic. The only problems is that occasionally the SQLLite database gets stuck and it messes up NPVR until I restart the recording process and sometimes need to Vacuum the database and/or reboot. The other problem is when a filename has some foreign accented characters in the name (that's you Hawaii 5-0) and the file copy functions have problems.

It's not quite foolproof enough for me to make available for general use, but if anyone that has Delphi experience is interested in experimenting with it I hope to have some time available to fiddle with it some more.

FWIW, here is the Handbrake command line that I use if you want to try manually converting any files. Note this is from a bash script so the $1 is analagous to %1 in a DOS batch file.

HandBrakeCLI -i "$1.ts" -o "$1.mp4" -e x264 -2 --turbo -m -s "1,2"

Steve Tyrakowski
gEd
Offline

Posting Freak

London
Posts: 3,514
Threads: 100
Joined: Jan 2005
#5
2017-06-01, 09:07 PM
SteveTyrakowski Wrote:The missing .ts file is the signal for my Delphi program to copy the .mp4 file to the NPVR video directory and then update the NPVR.DB3 database with the new filename and then deletes the .ts file.
Steve Tyrakowski

Technically, you don't need to update the database with the new file name. Whilst doing so is obviously "neater", I was just pondering if not doing so might help you with your db locking issue.

"If a .ts file is missing, it'll check the same name with .mpg/.avi/.wtv/.dvr-ms/.mp4/.mkv/m4v. Case is important. It only looks for lower case file extensions. "

http://forums.nextpvr.com/showthread.php...ranscoding

Also make sure you don't have UpdateEPGduringLiveTV enabled as that was a common cause of db locking issues.

I presume your bash script is dropping the dot and extension from the file name before calling the CLI. (for the benefit of others)
“If this is the way Queen Victoria treats her prisoners, she doesn't deserve to have any.”
SteveTyrakowski
Offline

Member

Posts: 142
Threads: 26
Joined: Dec 2004
#6
2017-06-13, 01:50 PM
gEd Wrote:Technically, you don't need to update the database with the new file name. Whilst doing so is obviously "neater", I was just pondering if not doing so might help you with your db locking issue.

"If a .ts file is missing, it'll check the same name with .mpg/.avi/.wtv/.dvr-ms/.mp4/.mkv/m4v. Case is important. It only looks for lower case file extensions. "

http://forums.nextpvr.com/showthread.php...ranscoding

Also make sure you don't have UpdateEPGduringLiveTV enabled as that was a common cause of db locking issues.

I presume your bash script is dropping the dot and extension from the file name before calling the CLI. (for the benefit of others)

If I do not update the database with the new extension, will NPVR do it, or does it just look for the other extensions when you try to play it? I need it updated so I can find out which file I need to transcode next by looking for the *.TS files in the database.

And yes, I pass the filename with the dot and extension omitted so that the script knows how to complete the input and output filenames from it.

Steve Tyrakowski
scJohn
Offline

Senior Member

Posts: 281
Threads: 41
Joined: Jun 2013
#7
2017-06-13, 08:37 PM
The extension is not kept in the database.

When it comes time for NextPVR to play a file, it take the title of the recording, adds the .ts file extension and then searches the appropriate directory for the file name. If that file name is not found, then the title of the recording and one of the following extensions - .mpg/.avi/.wtv/.dvr-ms/.mp4/.mkv/m4v is used to create a file name and the appropriate directory is searched. This file name creation/searching process is continues until either the file name is found or all of the file extensions have been exhausted.

It would be nice if all titles with multiple extensions were listed in the details pages so that a tile could be selected and played by file extension,not just the title.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,920
Threads: 956
Joined: May 2006
#8
2017-06-13, 09:14 PM
The full filename is actually in the database. The Video Library is designed for playing files that are not recorded. Since non ts files can't be played on clients using the library is a better choice in most cases.

Martin
puck64
Offline

Member

Australia
Posts: 130
Threads: 24
Joined: Aug 2015
#9
2017-07-02, 09:55 AM
Here is my PostProcessing.bat

It converts Non MPG files to MPG (AVC + AAC, AC3 or MPG1). It also does a Quick Stream Fix using VideoRedo.

I use MPG as the version of VideoRedo I have does not handle MP4's

I hope this gets you out of trouble.

ffmpeg can be obtained from https://ffmpeg.zeranoe.com/builds/


@ECHO off
REM setlocal EnableDelayedExpansion

set VideoReDo="C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs"
set AdScan="C:\Program Files (x86)\VideoReDoTVSuite\AdScan.vbs"
set Log="G:\Recorded tv\%~n1_Log.txt%"

G:
CD "G:\Recorded TV"
DEL /Q %Log%

ECHO "Called With " %1 " and " %2 >> %Log%
ECHO ======================================================= >> %Log%
ECHO Conversion Started On %DATE% At %TIME% >> %Log%
ECHO ======================================================= >> %Log%
ECHO. >> %Log%

REM =======================================================================================================
REM Loop Thru Recorded TV and Convert The .TS Files To .MPG
REM Then MOVE the WTV file to a Safe Place
REM =======================================================================================================

Title Processing - %~n1

REM =======================================================================================================
REM CONVERT TO MPG
REM =======================================================================================================
ECHO Started Converting %~n1.ts To MPG @ %TIME% >> %Log%

IF EXIST "F:\Converted_2_MPG\To_Extract\%~n1.mpg" (
del /F "F:\Converted_2_MPG\To_Extract\%~n1.mpg"
)

IF EXIST "F:\Converted_2_MPG\To_Extract\%~n1.txt" (
del /F "F:\Converted_2_MPG\To_Extract\%~n1.txt"
)

REM -vf "scale=720:576, yadif=0:-1"
REM -vf "scale=1920:1080, yadif=0:-1"

if %2 == 13 (
ffmpeg -i "%~dpn1.ts" -vcodec mpeg2video -aspect 16:9 -profile:v 4 -level:v 6 -b:v 8000k -bufsize 25000k -maxrate 25000k -vf "yadif=0:-1" -acodec ac3 -ab 256k -ar 48000 -ac 2 -f vob "F:\Converted_2_MPG\To_Extract\%~n1.mpg"
goto CPYxml)

if %2 == 20 (
ffmpeg -i "%~dpn1.ts" -vcodec mpeg2video -aspect 16:9 -profile:v 4 -level:v 6 -b:v 8000k -bufsize 25000k -maxrate 25000k -vf "yadif=0:-1" -acodec ac3 -ab 256k -ar 48000 -ac 2 -f vob "F:\Converted_2_MPG\To_Extract\%~n1.mpg"
goto CPYxml)

if %2 == 30 (
ffmpeg -i "%~dpn1.ts" -vcodec mpeg2video -aspect 16:9 -profile:v 4 -level:v 6 -b:v 8000k -bufsize 25000k -maxrate 25000k -vf "yadif=0:-1" -acodec ac3 -ab 256k -ar 48000 -ac 2 -f vob "F:\Converted_2_MPG\To_Extract\%~n1.mpg"
goto CPYxml)

if %2 == 31 (
ffmpeg -i "%~dpn1.ts" -vcodec mpeg2video -aspect 16:9 -profile:v 4 -level:v 6 -b:v 8000k -bufsize 25000k -maxrate 25000k -vf "yadif=0:-1" -acodec ac3 -ab 256k -ar 48000 -ac 2 -f vob "F:\Converted_2_MPG\To_Extract\%~n1.mpg"
goto CPYxml)

if %2 == 70 (
ffmpeg -i "%~dpn1.ts" -vcodec mpeg2video -aspect 16:9 -profile:v 4 -level:v 6 -b:v 8000k -bufsize 25000k -maxrate 25000k -vf "yadif=0:-1" -acodec ac3 -ab 256k -ar 48000 -ac 2 -f vob "F:\Converted_2_MPG\To_Extract\%~n1.mpg"
goto CPYxml)

if %2 == 90 (
ffmpeg -i "%~dpn1.ts" -vcodec mpeg2video -aspect 16:9 -profile:v 4 -level:v 6 -b:v 8000k -bufsize 25000k -maxrate 25000k -vf "yadif=0:-1" -acodec ac3 -ab 256k -ar 48000 -ac 2 -f vob "F:\Converted_2_MPG\To_Extract\%~n1.mpg"
goto CPYxml)

cscript //nologo %VideoReDo% "%~dpn1.ts" "F:\Converted_2_MPG\To_Extract\%~n1.mpg" /t1 /q /e /d )


:CPYxml
COPY /Y "%~dpn1.xml" "F:\Converted_2_MPG\To_Extract\%~n1.txt"

ECHO Ended Converting %~n1.ts To MPG @ %TIME% >> %Log%
ECHO. >> %Log%
ECHO ================================================ >> %Log%
ECHO Started Ad-Detective Scan of %~n1.mpg @ %TIME% >> %Log%

cscript //nologo %AdScan% "F:\Converted_2_MPG\To_Extract\%~n1.mpg" "F:\Converted_2_MPG\To_Extract\%~n1.VPrj" /q


ECHO Ended Ad-Detective Scan of %~n1.mpg @ %TIME% >> %Log%
ECHO. >> %Log%
ECHO ================================================ >> %Log%

ECHO Moving %~n1.ts >> %Log%
MOVE /Y "%~dpn1.ts" "D:\TS_BACKUP"
MOVE /Y "%~dpn1.xml" "D:\TS_BACKUP"
ECHO %DATE% %TIME% >> %Log%
ECHO ================================================ >> %Log%


ECHO ================================================ >> %Log%
ECHO. >> %Log%

ECHO All Done At %DATE% %TIME% >> %Log%
ECHO. >> %Log%
ECHO ================================================ >> %Log%
ECHO ================================================ >> %Log%

rem Rundll32.exe Powrprof.dll,SetSuspendState Sleep

EXIT

:EOJ
ECHO No Files To Process. Job ended At %DATE% %TIME% >> %Log%

rem Rundll32.exe Powrprof.dll,SetSuspendState Sleep

EXIT
Regards,
Mark

(Remember not to forget that which you don' t need to know.)
« Next Oldest | Next Newest »

Users browsing this thread: 2 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  RFC DVB tuning files mvallevand 0 550 2024-03-04, 01:22 PM
Last Post: mvallevand
  Thumbnail support for .wtv and .avi files in version 5 Jimixter 2 1,927 2019-12-18, 04:29 PM
Last Post: sub
  Watched Indicator for Multiple Video Files with the Same File Name cweseloh 1 1,784 2018-06-26, 05:02 PM
Last Post: sub
  Make the "Zip my log files" text larger HarryH3 1 1,454 2017-11-26, 08:04 AM
Last Post: sub
  video_ts files and metadata jam_zhou 8 4,722 2014-06-04, 12:05 AM
Last Post: mvallevand
  Power savings : .bat files needed to switch on/off setupbox_HDPVR_etc Abbadon 2 2,581 2013-11-11, 03:33 AM
Last Post: pBS
  Deleteing folders with NFO files mvallevand 8 4,189 2012-12-22, 08:28 PM
Last Post: mvallevand
  delete ".incommercial" files generated by comskip reven 2 2,029 2012-10-18, 04:26 PM
Last Post: pBS
  Separate log files for each NMT ElihuRozen 0 1,167 2012-05-30, 03:05 PM
Last Post: ElihuRozen
  Saving the old metadata in seperat xml-files for archiving porpuses fabhoff 4 2,244 2012-01-13, 01:25 AM
Last Post: shaunpatrick77

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

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

Linear Mode
Threaded Mode