NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Legacy (v4.x and earlier) v
« Previous 1 … 276 277 278 279 280 … 433 Next »
Transcoding

Transcoding
vintdiesel
Offline

Member

Posts: 114
Threads: 23
Joined: Jan 2012
#21
2012-11-05, 09:53 PM
I transcode to mp4 and one channel to mkv with a bitrate of 2000kb/s using ffmpeg at midnight to any shows that have not been watched (and deleted) that night. This results in file size being reduced by a factor of 5. I don't bother transcoding the 6pm NEWS as I keep only 2 recordings and is refreshed daily.

I perform different actions according to which channel I have recorded as audio streams are mapped differently across the channels and I only want AC3. My postprocessing.bat file handles the logic.

I bought an unlocked core i5 for the very reason of multitasking, transcoding and my upgraded CPU cooler is working wonders in keeping the machine quiet with minimum fan speeds and CPU core temps <60C @ 3.4Ghz.
Win Server: ASRock P67 Pro3 B3, i5 2500K 4.0Ghz, 16GB, Nvidia GT430 HDMI, Win 10 Pro 64bit, Win-TV Quad HD, Win-TV Nova-T USB.
UnRaid NAS Server: Gigabyte i7 2600 3.4Ghz, 16GB, S3 Trio VGA PCI Video, DVB LibreElec for DVB-T tuner drivers, Hauppage Win-TV 2210 Dual DVB-T.
Win Client: Intel NUC i3 Broadwell, 4GB Ram, 128GB SSD, Win 10 Pro 64bit.
Linux Client: Raspberry Pi 3+, OSMC + Kodi
OTAjunkie
Offline

Senior Member

Posts: 277
Threads: 49
Joined: Jul 2010
#22
2012-11-06, 02:38 PM
@vintdiesel,

can you post some of your ffmpeg scripts and your PP.bat?

I'm always looking for something new that's sensible.
My Mencoder scripts take about 65% time as the shows run time to process and I can't help but think with a quad core I could do better.
I think each core trundles along at about 40%.
On the other hand, with my present setup I can have four PP jobs running and still be recording(s) and watching live with PIP up and it's still smooth.
My CPU stays <50C and I only added a chassis fan to the stock CPU fan and heatsink cooling setup.
Server:ASUS F1A75-V Pro,Radeon HD 6000,AMD A6 3670K,SSD128GB,2xWD 2Tb,W7Ultx64,5.1spks,2xHaup2250-MC,ATI650,CM7777,WG HD-8800
ClientTongue4 3.4,ATI HD4650,W7Ult
ClientTongue4 3.06,NVIDA6200,W7Ult
Client:Gateway Netbook,W7Start/XPpro
nDroid Client:Samsung Galaxy Note(synced to previous days recordings)
vintdiesel
Offline

Member

Posts: 114
Threads: 23
Joined: Jan 2012
#23
2012-11-06, 11:47 PM
Yep, here is a copy of my PP.bat, the ffmpeg scripts are all contained within it. The basis of the script was developed from examples that some clever people had posted on this site, then I added what I needed to make it work for me. It took me a while as I am not that great with batch files:

Code:
rem --------------------------
rem PostProcessingBat
rem D.Little
rem Version 8
rem dated 18/03/2012
rem --------------------------

title PostProcessingBat

echo . >>processing.log
echo %date%,%time% - %3 - PostProcessing.bat invoked on %1 recorded channel %2 on tuner %4 >>processing.log
echo %3 > %3.ppr

rem only start processing between midnight and 10am
:loop
set hrs=%TIME:~0,2%
rem the ~0,2 picks up the first 2 characters of the Time variable (position and length)

if %hrs% geq 10 (
rem echo ...%hrs% hours waiting 10 minutes
  sleep 600
  goto loop
)

rem need to add a pause to avoid race conditions by taking last two digits of the OID and using them as a delay in seconds
set delay=%3
set delay=%delay:~-2%
echo %date%,%time% - %3 - sleeping %delay% seconds to avoid simultaneous execution >>processing.log
sleep %delay%

rem check how many ffmpegs are running; if 1 or more are running wait 1 minute and check again
rem the third parameter passed in npvr 1.5.36 and later is a unique recording oid number, so it makes a good filename to store the temporary count

:check1
tasklist | find /c "ffmpeg" > %3.ppr
set /p count= <%3.ppr
if %count% geq 1 (
  echo %date%,%time% - %3 - %count% ffmpegs running now, waiting 1 minute >>processing.log
  sleep 60
  goto check1
)

rem continuing now

Rem any channel number > 10 skip post processing requirement
if %2% gtr 10 goto skip

Rem if the NEWS is recorded skip postprocessing requirement
set filename=%1%
set prefix="%filename:~18,15%"
if %prefix%=="ONE News At 6pm" goto skip

echo %date%,%time% - %3 - transcoding invoked on %1 >>processing.log

Rem list of channels to run transcoding on

if %2% equ 1 goto profile3
if %2% equ 2 goto profile3
if %2% equ 3 goto profile3
if %2% equ 4 goto profile3
if %2% equ 5 goto profile5
if %2% equ 6 goto profile3
if %2% equ 7 goto profile7
if %2% equ 8 goto profile3
if %2% equ 9 goto profile9
if %2% equ 10 goto profile10

goto eof

REM Encode to mp4 changing file extension

:profile1
"C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe" -y -i %1 -b:v 2000k -map 0:0 -map 0:3 -c:a copy -ar 48000 -async 48000 "%~dpn1".mp4
goto deletets

:profile3
"C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe" -y -i %1 -b:v 2000k -deinterlace -map 0:0 -map 0:1 -c:a libvo_aacenc -ar 48000 -async 48000 "%~dpn1".mp4
goto deletets

:profile5
"C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe" -y -i %1 -b:v 2000k -deinterlace -map 0:0 -map 0:2 -c:a libvo_aacenc -ar 48000 -async 48000 "%~dpn1".mp4
goto deletets

:profile7
"C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe" -y -i %1 -b:v 2000k -deinterlace -map 0:0 -map 0:1 -c:a libvo_aacenc -ar 48000 -async 48000 "%~dpn1".mp4
goto deletets

:profile9
"C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe" -y -i %1 -b:v 2000k -c:a libvo_aacenc -ar 48000 -async 48000 "%~dpn1".mkv
goto deletets

:profile10
"C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe" -y -i %1 -b:v 2000k -deinterlace -map 0:1 -map 0:2 -c:a libvo_aacenc -ar 48000 -async 48000 "%~dpn1".mp4
goto deletets


:deletets
REM Delete original TS
del %1
echo %date%,%time% - %3 - deleted %1 recorded from channel %2 >>processing.log
goto check2

:skip
echo %date%,%time% - %3 - channel doesn't require transcoding >>processing.log
goto check2

rem check how many ffmpegs are running; if 1 or more are running wait 1 minute and check again
rem the third parameter passed in npvr 1.5.36 and later is a unique recording oid number, so it makes a good filename to store the temporary count

:check2
rem check for other postprocesses in 2 minutes else put PC into Standby
sleep 120
tasklist | find /c "ffmpeg" > %3.ppr
set /p count= <%3.ppr
echo %date%,%time% - %3 - %count% ffmpegs running >>processing.log
if %count% geq 1 (
  echo %date%,%time% - %3 - %count% ffmpegs running, end without standby >>processing.log
  del %3.ppr
  goto finish
)

tasklist | find /c "sleep" > %3.ppr
set /p count= <%3.ppr
echo %date%,%time% - %3 - %count% sleeps running >>processing.log
if %count% geq 1 (
  echo %date%,%time% - %3 - %count% sleeps running, end without standby >>processing.log
  del %3.ppr
  goto finish
)

del %3.ppr
if exist *.ppr goto finish

rem continuing now

:standby
rem put PC into standby
del %3.ppr
echo %date%,%time% - %3 - PC Standby called >>processing.log
echo -------------------------------------- >>processing.log
rundll32 powrprof.dll,SetSuspendState 0,1,0

:finish
rem finish without putting PC into standby
:eof
Win Server: ASRock P67 Pro3 B3, i5 2500K 4.0Ghz, 16GB, Nvidia GT430 HDMI, Win 10 Pro 64bit, Win-TV Quad HD, Win-TV Nova-T USB.
UnRaid NAS Server: Gigabyte i7 2600 3.4Ghz, 16GB, S3 Trio VGA PCI Video, DVB LibreElec for DVB-T tuner drivers, Hauppage Win-TV 2210 Dual DVB-T.
Win Client: Intel NUC i3 Broadwell, 4GB Ram, 128GB SSD, Win 10 Pro 64bit.
Linux Client: Raspberry Pi 3+, OSMC + Kodi
boy914
Offline

Junior Member

Posts: 2
Threads: 0
Joined: Jun 2012
#24
2012-11-07, 04:19 PM
Similar to the NextPVREncoder posted a few weeks back, I wrote my own little .NET app called by PostProcessing.bat to run comskip, Handbrake to m4v (different settings depending on the show), add chapters to the recording using the comskip output (I also don't trust comskip to edit the recordings out, so I just put chapters in the recording and manually skip as I watch), rename the recording using the SxxExx convention (using the Sickbeard API to query the show data), and then finally copy the file to my Sickbeard watch folder. In the end, I have a much smaller file with chapter markers at commercials, all organized with the rest of my television shows managed by Sickbeard. I use XBMC to watch the shows on a Win7 HTPC in the living room and a RPi in the bedroom.

(Yes, I'm a little proud of it, although I wrote it in a way that probably doesn't lend itself to sharing without some refactoring.)

-Rick
vgossain
Offline

Junior Member

Posts: 16
Threads: 3
Joined: Jan 2012
#25
2012-12-26, 10:07 PM
boy914 Wrote:Similar to the NextPVREncoder posted a few weeks back, I wrote my own little .NET app called by PostProcessing.bat to run comskip, Handbrake to m4v (different settings depending on the show), add chapters to the recording using the comskip output (I also don't trust comskip to edit the recordings out, so I just put chapters in the recording and manually skip as I watch), rename the recording using the SxxExx convention (using the Sickbeard API to query the show data), and then finally copy the file to my Sickbeard watch folder. In the end, I have a much smaller file with chapter markers at commercials, all organized with the rest of my television shows managed by Sickbeard. I use XBMC to watch the shows on a Win7 HTPC in the living room and a RPi in the bedroom.

(Yes, I'm a little proud of it, although I wrote it in a way that probably doesn't lend itself to sharing without some refactoring.)

-Rick

Rick, any chance you can post it, even if it isn't very simple to explain what is going on? I'm looking to do that exact same thing and would love to start from somewhere instead of from scratch.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): « Previous 1 2 3


Possibly Related Threads…
Thread Author Replies Views Last Post
  Recording without transcoding javidial 9 2,341 2018-12-01, 12:59 AM
Last Post: javidial
  Recording Failure - HDHR Transcoding craigrs84 6 2,208 2018-10-15, 02:23 AM
Last Post: pkscout
  HDHomerun Extend Transcoding Not Working satcoms 12 4,725 2017-12-09, 04:16 PM
Last Post: sub
  Questions about transcoding from IPTV sources JP23 32 10,448 2017-10-31, 09:33 AM
Last Post: pme
  Strange transcoding on recording Reddwarf 3 2,012 2017-02-19, 11:13 PM
Last Post: sub
  Option to disable transcoding? Ludron 2 2,017 2017-02-16, 08:41 PM
Last Post: Ludron
  Transcoding to h.264 to play on Roku/phone/tablet. Looking for best practice. wayloncovil 0 1,108 2016-11-20, 06:29 AM
Last Post: wayloncovil
  NextPVR, Transcoding and NEWA wayloncovil 1 1,190 2016-09-23, 06:28 PM
Last Post: mvallevand
  live tv transcoding chiefmongo 2 2,237 2016-09-17, 07:27 PM
Last Post: mvallevand
  Transcoding LiveTV madas 83 22,677 2016-04-07, 11:35 AM
Last Post: uspino

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

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

Linear Mode
Threaded Mode