Page 2 of 4

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 18th, 2008, 4:48 am
by doubledrat
my mistake, in the for, you need to quote "%dirname%"

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 18th, 2008, 7:16 am
by themugger
Perfect, cheers

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 23rd, 2008, 1:57 pm
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!

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 25th, 2008, 12:56 pm
by RXP
Awesome script! Thanks for this. Any chance of getting something similar to join *.ts files?

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 27th, 2008, 8:34 am
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

?

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 27th, 2008, 8:41 am
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!

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 27th, 2008, 9:09 am
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.

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 27th, 2008, 9:12 am
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

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 27th, 2008, 1:53 pm
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?

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 27th, 2008, 2:15 pm
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

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 27th, 2008, 5:16 pm
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

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 27th, 2008, 9:59 pm
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

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 28th, 2008, 3:47 am
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?

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 28th, 2008, 4:40 am
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!

Re: Automatic Media Conversion (Ipod / Iphone)

Posted: December 28th, 2008, 10:47 am
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!