Automatic Media Conversion (Ipod / Iphone)

Come up with a useful post-processing script? Share it here!
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Automatic Media Conversion (Ipod / Iphone)

Post by doubledrat »

my mistake, in the for, you need to quote "%dirname%"
themugger
Release Testers
Release Testers
Posts: 30
Joined: June 11th, 2008, 10:44 am

Re: Automatic Media Conversion (Ipod / Iphone)

Post by themugger »

Perfect, cheers
User avatar
pieteckhart
Release Testers
Release Testers
Posts: 131
Joined: April 30th, 2008, 9:34 am
Location: Netherlands
Contact:

Re: Automatic Media Conversion (Ipod / Iphone)

Post by pieteckhart »

Code: Select all

set name=%3
set name=%name:"=%
set dirname=%1
set dirname=%dirname:"=%

for /R "%dirname%" %%f in (*.avi) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "%dirname%\%name%.mp4"
for /R "%dirname%" %%f in (*.mkv) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "%dirname%\%name%.mp4"
for /R "%dirname%" %%f in (*.wmv) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "%dirname%\%name%.mp4"
Works like a charm :D
i put ffmpeg.exe inside C:\Windows\System32\ so i can use from anywhere in my system :D
thanks for posting this!
Last edited by pieteckhart on December 24th, 2008, 6:41 am, edited 1 time in total.
SABnzbd+ Windows 7 Gadget
Manage your downloads from your desktop.
Download: http://eckhart.hopto.org/sabgadget/sabgadget2.gadget
Site: http://eckhart.hopto.org/sabgadget/
RXP
Jr. Member
Jr. Member
Posts: 53
Joined: January 22nd, 2008, 8:57 am

Re: Automatic Media Conversion (Ipod / Iphone)

Post by RXP »

Awesome script! Thanks for this. Any chance of getting something similar to join *.ts files?
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Automatic Media Conversion (Ipod / Iphone)

Post by doubledrat »

RXP wrote: Awesome script! Thanks for this. Any chance of getting something similar to join *.ts files?
I've never done that.  what's the command?  just

copy filea.ts+file2.ts+file3.ts all.ts

?
jl0810
Newbie
Newbie
Posts: 18
Joined: December 27th, 2008, 8:01 am

Re: Automatic Media Conversion (Ipod / Iphone)

Post by jl0810 »

This is a highly useful thread ;D

One quick comment/request - any way to add a simple command to delete the original file once ipod conversion is complete via ffmpeg?

Thanks in advance!
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Automatic Media Conversion (Ipod / Iphone)

Post by doubledrat »

RXP wrote: Awesome script! Thanks for this. Any chance of getting something similar to join *.ts files?
just by chance, I downloaded a multi-part ts last night, so this is what you need to join them -

Code: Select all

set name=%3
set name=%name:"=%
set dirname=%1
set dirname=%dirname:"=%

copy /B "%dirname%\*.ts" "%dirname%\temp.newts" && del /q "%dirname%\*.ts" && rename "%dirname%\temp.newts" "%name%.ts" 
this should join the files into a new one.  delete the old ones and rename the new one. (the && means only do the next command if the previous one succeeded)

I imagine there are other progs out there to do this, but this is how i'd do it using built-in commands.
Last edited by doubledrat on December 27th, 2008, 9:19 am, edited 1 time in total.
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Automatic Media Conversion (Ipod / Iphone)

Post by doubledrat »

jl0810 wrote: This is a highly useful thread ;D

One quick comment/request - any way to add a simple command to delete the original file once ipod conversion is complete via ffmpeg?

Thanks in advance!
I would think sticking this on the end of the "for" lines would work

Code: Select all

 && del %%f
jl0810
Newbie
Newbie
Posts: 18
Joined: December 27th, 2008, 8:01 am

Re: Automatic Media Conversion (Ipod / Iphone)

Post by jl0810 »

Thanks - think thats going to work.  Testing now but FFMPEG take a while on my pentitum 4.  This may be slightly off topic but if I wanted to then move the converted mp4 file say to a dedicated directory ("C:\ConvertedVids"), is that easy as well?
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: Automatic Media Conversion (Ipod / Iphone)

Post by rascalli »

that should be possible also.

Have a look here : http://forums.sabnzbd.org/index.php?topic=61.0

In this script it moves the files after joining is done
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Automatic Media Conversion (Ipod / Iphone)

Post by doubledrat »

jl0810 wrote: Thanks - think thats going to work.  Testing now but FFMPEG take a while on my pentitum 4.  This may be slightly off topic but if I wanted to then move the converted mp4 file say to a dedicated directory ("C:\ConvertedVids"), is that easy as well?

easier to create the mp4 in that directory.  just replace the %dirname% at the end of the ffmpeg line with your directory.  will even speed up the process if it's on another hard drive
jl0810
Newbie
Newbie
Posts: 18
Joined: December 27th, 2008, 8:01 am

Re: Automatic Media Conversion (Ipod / Iphone)

Post by jl0810 »

Good info.  I was happy with the new script, but had some trouble tweaking the values of ffmpeg to give me a "universal" video that would work on my ipod and apple tv - at a high quality level.  So i switched out FFMPEG for Handbrake CLI and used the universal settings.  So if you're interested in Handbrake (I'm a huge fan), you just need to download the Handbrake CLI, and use this in place of the FFMPEG command in the For lines

HandBrakeCLI.exe -i "%%f" -o "%dirname%\%name%.mp4"  -e x264 -q 0.589999973773956 -a 1,1 -E faac,ac3 -B 160,auto -R 48,Auto -6 dpl2,auto -f mp4 -X 720 -P -m -x level=30:cabac=0:ref=3:mixed-refs=1:analyse=all:me=umh:no-fast-pskip=1

I've only tested once so don't expect anything too flawless quite yet
RXP
Jr. Member
Jr. Member
Posts: 53
Joined: January 22nd, 2008, 8:57 am

Re: Automatic Media Conversion (Ipod / Iphone)

Post by RXP »

doubledrat wrote:
RXP wrote: Awesome script! Thanks for this. Any chance of getting something similar to join *.ts files?
just by chance, I downloaded a multi-part ts last night, so this is what you need to join them -

Code: Select all

set name=%3
set name=%name:"=%
set dirname=%1
set dirname=%dirname:"=%

copy /B "%dirname%\*.ts" "%dirname%\temp.newts" && del /q "%dirname%\*.ts" && rename "%dirname%\temp.newts" "%name%.ts" 
this should join the files into a new one.  delete the old ones and rename the new one. (the && means only do the next command if the previous one succeeded)

I imagine there are other progs out there to do this, but this is how i'd do it using built-in commands.
Awesome! Thank you so much. I tried the script last night and it works, but only one problem - it joined every single ts file in my download directory into one big file lol. Anyway to only get it to process the file that's been downloaded?
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Automatic Media Conversion (Ipod / Iphone)

Post by doubledrat »


Awesome! Thank you so much. I tried the script last night and it works, but only one problem - it joined every single ts file in my download directory into one big file lol. Anyway to only get it to process the file that's been downloaded?
you'll need to get sabnzbd to create a new directory for every item it downloads, otherwise there's no real way of knowing what files relate to the download!  It's easy to do...

sorry, I assumed that's what you'd be doing!
RXP
Jr. Member
Jr. Member
Posts: 53
Joined: January 22nd, 2008, 8:57 am

Re: Automatic Media Conversion (Ipod / Iphone)

Post by RXP »

Well I do, but with Sab's TV sorting option enabled it extracts it to a single folder. I guess I'll just manually add a category for ts files.

And it wasn't your fault, just glad I finally have a solution to joining ts files, been wanting one for like 2 years now!
Post Reply