SageTV Community  

Go Back   SageTV Community > General Discussion > General Discussion
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

General Discussion General discussion about SageTV and related companies, products, and technologies.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-20-2011, 11:38 AM
panteragstk's Avatar
panteragstk panteragstk is offline
SageTVaholic
 
Join Date: Oct 2008
Location: New Braunfels, TX
Posts: 3,312
Batch video conversion

I've been looking for a way to convert .mov files to .ts or .m2ts for use in sagetv. The reason I want to be able to do this is sage splitter and .mov don't get along so well. I can easily convert with tsmuxer, but it doesn't support batch operations. The automatic trailer downloader on the mymovies.dk site supports "post processing" which I need a program that supports batch. Does anyone know of any software that will do what I'm asking?
__________________
SageTV Server: unRAID Docker v9, S2600CPJ, Norco 24 hot swap bay case, 2x Xeon 2670, 64 GB DDR3, 3x Colossus for DirecTV, HDHR for OTA
Living room: nVidia Shield TV, Sage Mini Client, 65" Panasonic VT60
Bedroom: Xiomi Mi Box, Sage Mini Client, 42" Panasonic PZ800u
Theater: nVidia Shield TV, mini client, Plex for movies, 120" screen. Mitsubishi HC4000. Denon X4300H. 7.4.4 speaker setup.
Reply With Quote
  #2  
Old 03-20-2011, 01:12 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
I wrote this a while back to remux Apple Trailers into mkv with AC3 audio, using only tools that come with Sage, aside form MKVMerge. Just paste it into notepad and save it as a .bat file.

Code:
@echo OFF
cd d:\test\
set input=%1
set output=%input:.mov=.mkv%

if EXIST %output% GOTO EXISTS

D:\sageserver\sagetv\sagetvtranscoder.exe -i %input% > d:\test\fmt.txt 2>&1 
findstr /R "Audio.*5\.1" d:\test\fmt.txt
echo. %errorlevel%
if %ERRORLEVEL% EQU 0 GOTO DD

findstr /R "Audio.*stereo" d:\test\fmt.txt
echo. %errorlevel%
if %ERRORLEVEL% EQU 0 GOTO ST

goto ERR

:DD
echo. "It's 5.1!"
REM D:\sageserver\sagetv\sagetvtranscoder.exe -i %input% -vn -acodec ac3 -ab 640k -ar 48000 -ac 6 -y d:\test\tmp.ac3
"C:\Program Files (x86)\megui\tools\mencoder\mencoder" -channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=640 -ovc frameno -of rawaudio -o d:\test\tmp.ac3 %input%
REM "C:\Program Files (x86)\megui\tools\mkvmerge\mkvmerge" -o %output% -d 1 -A S %input% -a 0 -D -S d:\test\tmp.ac3 --track-order 0:1,1:0
goto OK

:ST
echo. "It's Stereo!"
REM D:\sageserver\sagetv\sagetvtranscoder.exe -i %input% -vn -acodec ac3 -ab 192k -ar 48000 -ac 2 -y d:\test\tmp.ac3
"C:\Program Files (x86)\megui\tools\mencoder\mencoder" -oac lavc -lavcopts acodec=ac3:abitrate=192 -ovc frameno -of rawaudio -o d:\test\tmp.ac3 %input%
REM "C:\Program Files (x86)\megui\tools\mkvmerge\mkvmerge" -o %output% -d 1 -A S %input% -a 0 -D -S d:\test\tmp.ac3 --track-order 0:1,1:0
goto OK

:OK
findstr /R "0\.0.*Video" d:\test\fmt.txt
echo %errorlevel%
if %ERRORLEVEL% EQU 0 GOTO V0

findstr /R "0\.1.*Video" d:\test\fmt.txt
echo %errorlevel%
if %ERRORLEVEL% EQU 0 GOTO V1

goto ERR

:V0
echo. "Video is stream 0!"
"C:\Program Files (x86)\megui\tools\mkvmerge\mkvmerge.exe" -o %output% -d 1 -A -S %input% -a 0 -D -S d:\test\tmp.ac3 --track-order 0:1,1:0
REM echo "C:\Program Files (x86)\megui\tools\mkvmerge\mkvmerge" -o %output%  "--forced-track" "2:no" "-d" "2" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" %input% "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "D:\test\tmp.ac3" "--track-order" "0:1,1:0"
REM "C:\Program Files (x86)\megui\tools\mkvmerge\mkvmerge" -o %output%  "--forced-track" "2:no" "-d" "2" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" %input% "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "D:\test\tmp.ac3" "--track-order" "0:1,1:0"
REM del tmp.ac3
REM del %input%
goto end


:V1
echo. "Video is stream 1!"
REM"C:\Program Files (x86)\megui\tools\mkvmerge\mkvmerge.exe" -o %output% -d 1 -A -S %input% -a 0 -D -S d:\test\tmp.ac3 --track-order 0:1,1:0
echo "C:\Program Files (x86)\megui\tools\mkvmerge\mkvmerge" -o %output%  "--forced-track" "2:no" "-d" "2" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" %input% "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "D:\test\tmp.ac3" "--track-order" "0:1,1:0"
"C:\Program Files (x86)\megui\tools\mkvmerge\mkvmerge" -o %output%  "--forced-track" "2:no" "-d" "2" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" %input% "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "D:\test\tmp.ac3" "--track-order" "0:1,1:0"
REM del tmp.ac3
REM del %input%
goto end

:EXISTS
echo. "Already exists, skipping."
REM del %input%

:ERR
echo. "It's Unknown!"
goto end

:end
del d:\test\fmt.txt
Works quite well, just drop a file on top of it. You'll have to fix the paths of course, and you can remove the "REM" from "REM del %input%" and it will delete the source file for you.
Reply With Quote
  #3  
Old 03-20-2011, 01:36 PM
panteragstk's Avatar
panteragstk panteragstk is offline
SageTVaholic
 
Join Date: Oct 2008
Location: New Braunfels, TX
Posts: 3,312
Thanks. I'll give that a try. I don't know why the sage splitter makes .mov files play so blocky, but this might help.
__________________
SageTV Server: unRAID Docker v9, S2600CPJ, Norco 24 hot swap bay case, 2x Xeon 2670, 64 GB DDR3, 3x Colossus for DirecTV, HDHR for OTA
Living room: nVidia Shield TV, Sage Mini Client, 65" Panasonic VT60
Bedroom: Xiomi Mi Box, Sage Mini Client, 42" Panasonic PZ800u
Theater: nVidia Shield TV, mini client, Plex for movies, 120" screen. Mitsubishi HC4000. Denon X4300H. 7.4.4 speaker setup.
Reply With Quote
  #4  
Old 03-20-2011, 02:02 PM
panteragstk's Avatar
panteragstk panteragstk is offline
SageTVaholic
 
Join Date: Oct 2008
Location: New Braunfels, TX
Posts: 3,312
That didn't work. MKV's use the same splitter as .mov files. If I convert to .m2ts or .ts it uses a different splitter and the playback issues go away.
__________________
SageTV Server: unRAID Docker v9, S2600CPJ, Norco 24 hot swap bay case, 2x Xeon 2670, 64 GB DDR3, 3x Colossus for DirecTV, HDHR for OTA
Living room: nVidia Shield TV, Sage Mini Client, 65" Panasonic VT60
Bedroom: Xiomi Mi Box, Sage Mini Client, 42" Panasonic PZ800u
Theater: nVidia Shield TV, mini client, Plex for movies, 120" screen. Mitsubishi HC4000. Denon X4300H. 7.4.4 speaker setup.
Reply With Quote
  #5  
Old 03-20-2011, 02:05 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Interesting, the MKV's play fine on the extenders (though mov's don't).

Though it would be pretty easy to replace mkvmerge in that with tsmuxer.
Reply With Quote
  #6  
Old 03-20-2011, 04:36 PM
panteragstk's Avatar
panteragstk panteragstk is offline
SageTVaholic
 
Join Date: Oct 2008
Location: New Braunfels, TX
Posts: 3,312
Quote:
Originally Posted by stanger89 View Post
Interesting, the MKV's play fine on the extenders (though mov's don't).

Though it would be pretty easy to replace mkvmerge in that with tsmuxer.
It would except for the fact that tsmuxer requires a .meta file that contains the command line. I can't find any simple software that will do what I want. This is frustrating.

If I could find a way to automatically create the .meta file I would be in business.

I suck at creating batch files or even using command line .exe's. It's been too long since my dos days.

Here is the manual if anyone would like to help me out with this.
__________________
SageTV Server: unRAID Docker v9, S2600CPJ, Norco 24 hot swap bay case, 2x Xeon 2670, 64 GB DDR3, 3x Colossus for DirecTV, HDHR for OTA
Living room: nVidia Shield TV, Sage Mini Client, 65" Panasonic VT60
Bedroom: Xiomi Mi Box, Sage Mini Client, 42" Panasonic PZ800u
Theater: nVidia Shield TV, mini client, Plex for movies, 120" screen. Mitsubishi HC4000. Denon X4300H. 7.4.4 speaker setup.

Last edited by panteragstk; 03-20-2011 at 04:40 PM.
Reply With Quote
  #7  
Old 03-20-2011, 05:22 PM
panteragstk's Avatar
panteragstk panteragstk is offline
SageTVaholic
 
Join Date: Oct 2008
Location: New Braunfels, TX
Posts: 3,312
looking into this more it would seem that mencoder or ffmpeg could accomplish the same thing.

"mencoder.exe -oac copy -ovc copy"

the above would keep the audio and video in tact, but I have no idea how to get the file to output a .m2ts file. I would like to be able to run the batch file in the directory with the trailers and have it change all to .m2ts then send them to another directory after deleting the original files. How do I make that happen?
__________________
SageTV Server: unRAID Docker v9, S2600CPJ, Norco 24 hot swap bay case, 2x Xeon 2670, 64 GB DDR3, 3x Colossus for DirecTV, HDHR for OTA
Living room: nVidia Shield TV, Sage Mini Client, 65" Panasonic VT60
Bedroom: Xiomi Mi Box, Sage Mini Client, 42" Panasonic PZ800u
Theater: nVidia Shield TV, mini client, Plex for movies, 120" screen. Mitsubishi HC4000. Denon X4300H. 7.4.4 speaker setup.
Reply With Quote
  #8  
Old 03-20-2011, 05:26 PM
Spectrum Spectrum is offline
Sage Expert
 
Join Date: Aug 2006
Posts: 720
Quote:
Originally Posted by panteragstk View Post
It would except for the fact that tsmuxer requires a .meta file that contains the command line. I can't find any simple software that will do what I want. This is frustrating.

If I could find a way to automatically create the .meta file I would be in business.

I suck at creating batch files or even using command line .exe's. It's been too long since my dos days.

Here is the manual if anyone would like to help me out with this.
Code:
echo "V_MPEG4/ISO/AVC, D:\media\test\stream.h264, fps=25" >> temp.meta
echo "A_AC3, D:\media\test\stream.ac3, timeshift=-10000ms" >> temp.meta
tsmuxer --blah --blah --blah
del temp.meta
Of course that relies on you being able to parse out any extra info you need (timeshift, fps, etc) from elsewhere.
Reply With Quote
  #9  
Old 03-20-2011, 06:22 PM
panteragstk's Avatar
panteragstk panteragstk is offline
SageTVaholic
 
Join Date: Oct 2008
Location: New Braunfels, TX
Posts: 3,312
Quote:
Originally Posted by Spectrum View Post
Code:
echo "V_MPEG4/ISO/AVC, D:\media\test\stream.h264, fps=25" >> temp.meta
echo "A_AC3, D:\media\test\stream.ac3, timeshift=-10000ms" >> temp.meta
tsmuxer --blah --blah --blah
del temp.meta
Of course that relies on you being able to parse out any extra info you need (timeshift, fps, etc) from elsewhere.
Thanks, I'm still trying to figure out a simple way to accomplish this task with ffmpeg now.

this are the parameters I have now " -i %1 -vcodec copy -acodec copy %1.m2ts" but nothing happens.

if I'm correct %1 is like having *.mov right? I'm starting to remember how to create these files, but it is taking a while.
__________________
SageTV Server: unRAID Docker v9, S2600CPJ, Norco 24 hot swap bay case, 2x Xeon 2670, 64 GB DDR3, 3x Colossus for DirecTV, HDHR for OTA
Living room: nVidia Shield TV, Sage Mini Client, 65" Panasonic VT60
Bedroom: Xiomi Mi Box, Sage Mini Client, 42" Panasonic PZ800u
Theater: nVidia Shield TV, mini client, Plex for movies, 120" screen. Mitsubishi HC4000. Denon X4300H. 7.4.4 speaker setup.
Reply With Quote
  #10  
Old 03-20-2011, 06:46 PM
panteragstk's Avatar
panteragstk panteragstk is offline
SageTVaholic
 
Join Date: Oct 2008
Location: New Braunfels, TX
Posts: 3,312
ffmpeg doesn't support .m2ts. That answers that question.
__________________
SageTV Server: unRAID Docker v9, S2600CPJ, Norco 24 hot swap bay case, 2x Xeon 2670, 64 GB DDR3, 3x Colossus for DirecTV, HDHR for OTA
Living room: nVidia Shield TV, Sage Mini Client, 65" Panasonic VT60
Bedroom: Xiomi Mi Box, Sage Mini Client, 42" Panasonic PZ800u
Theater: nVidia Shield TV, mini client, Plex for movies, 120" screen. Mitsubishi HC4000. Denon X4300H. 7.4.4 speaker setup.
Reply With Quote
  #11  
Old 03-20-2011, 06:46 PM
Spectrum Spectrum is offline
Sage Expert
 
Join Date: Aug 2006
Posts: 720
You won't be able to use wildcards like *.mov due to the way the command interperter will expand things. You would have to call the .bat fiile once for each .mov. That can be accomplished using a for statement from the command line
Code:
for %i in (*.mov) do myconverter.bat %i
Remember that if you use a for statement from inside a batch file to double the % on the vars, so %i would be %%i

Also the way you have that written it would expand to
Code:
ffmpegenc -i mov1.mov -vcodec copy -acodec copy mov1.mov.m2ts
If you want to use a for loop from outside the batch file to catch all the .movs in a directory and not get the .mov.m2ts extenion concatenation, you could have the encoder parms like
Code:
ffmpegenc -i %1 -vcodec copy -acodec copy %2
then call batch file from a for loop
Code:
for %i in (*.mov) do myconverter.bat %i~ni.m2ts
That would encode movie1.mov to movie1.m2ts.

There are other ways to skin that cat, but that's the first one that comes to mind
Reply With Quote
  #12  
Old 03-23-2011, 01:36 PM
mgpaulus mgpaulus is offline
Sage Advanced User
 
Join Date: Mar 2011
Location: Colorado Springs, CO
Posts: 193
You might also check out VLC from videolan.org. It does support command line work, and has many options. Getting everything figured out might be tricky, but once you get it done, it should be smooth.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Video Category batch set 0x1a4 SageMC Custom Interface 2 06-01-2008 09:02 AM
questions on video conversion garyellis SageTV Beta Test Software 0 12-08-2006 08:56 AM
Windows Media batch conversion recipe ku71 General Discussion 0 06-18-2003 10:47 PM
The quest for batch conversion ku71 General Discussion 3 05-30-2003 12:41 PM


All times are GMT -6. The time now is 03:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.