Converting videos for portable devices (including softsubs)

If you have questions about compression/encoding/converting look here.
User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Converting videos for portable devices (including softsubs)

Post by Corran » Mon Jul 20, 2009 11:14 pm

Actually, the encodes follow the baseline profile so they should work on anything that that can play h.264 content such as the PS3, etc.

Before I say anything else, this particular process requires a Windows pc. Sorry linux/mac users. If you examine my script you might be able to recreate what it is doing and make something even better than I have. MSDOS is very limited...

Anyways, a week or so ago I wanted to load a softsubbed file onto my T-Mobile G1 to watch while riding in someone's car. I quickly discovered that softsub support on the plethora of video conversion apps is lacking for matroska files. Some apps can do it, but they require the subtitle file to first be extracted from the MKV. Annoying.

I was also kind of annoyed at the fact that pretty much all of the converters felt bloated and slow. Some of them were chalk full of ads, even the one I found on sourceforge... I just wanted something quick and simple without any other crap. So I created a batch file that will encode any video file I drag on top of it and packaged it into a self-contained zip archive.

Convert MP4 Portable 1.1.2

Before you begin you must obtain a copy of neroAacEnc.exe and MP4Box.exe and plug them into their respective folders in the "tools" directory. It is a pain in the ass, but distributing binary versions of these files is legally dubious so I'm covering myself by keeping them out of the zip. NeroAacEnc can be found at the Nero website which is linked below. If you have ZarxGUI then you probably already have MP4Box somewhere on your computer... if not search the internet for mp4box builds. Aside from GPAC source code, I will not be linking to mp4box binaries here.

neroAacEnc download link
MP4Box source code

To convert files you have two options:
  1. You can drag a single video onto the batch file or...
  2. You can fill the "files_to_process" folder with videos and then double click on the batch file. In this case, once the original video files are processed they will be moved to the "processed_files" folder.
In either case, once encodes are complete, they can be found in the "converted_files" folder.

There are some pros and cons to this approach, most of the cons are a result of MS DOS limitations.

PROS
  • Simple (drag file onto batch, wait for process to finish, load file onto your ipod/android device)
  • Batch processing
  • Can handle softsubs
  • Supports a lot of files types and codecs. (Will encode pretty much anything mplayer can play. I've tested it with avi, mp4, mkv, mov, asx, wmv, mpeg, divx, and ogm files as well.)
CONS
  • I can't detect fps so I'm converting every video to 29.97 fps. However, I have not noticed any audio sync issues in my testing...
Settings:
You can change the bitrate of the audio and video, width of the resulting encodes, which language subtitle to use, and whether or not to run 2 pass encoding by editing some variables in the batch file. Just right click the file and choose edit.

I might be forgetting some things but that is pretty much it. Hope people find this useful.

User avatar
AaronAMV
eating that e. coli spinach
Joined: Tue Jan 22, 2008 7:54 pm
Status: (◔ ◡ ◔ )
Location: (◔ ◡ ◔ )
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by AaronAMV » Mon Jul 20, 2009 11:25 pm

So you can drag a softsub into the .bat, and the result will be an mp4 (for iTouch as an example) with subs? That's awesome! Good job sir.
Image

User avatar
Pwolf
Friendly Neighborhood Pwaffle
Joined: Thu May 03, 2001 4:17 pm
Location: Some where in California, I forgot :\
Contact:
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by Pwolf » Tue Jul 21, 2009 1:30 am

i run a bat file to encode stuff for my xbox. to handle multiple files, I copy them all to a folder then run another bat file called "run.bat" which takes each file (mkv files specifically) in the folder and runs the "encode.bat" file on it.

run.bat

Code: Select all

for /f "tokens=*" %%a in ('dir /s /a /one /b *.mkv') do convert.bat "%%a"
Hope that helps.


Pwolf

User avatar
Pwolf
Friendly Neighborhood Pwaffle
Joined: Thu May 03, 2001 4:17 pm
Location: Some where in California, I forgot :\
Contact:
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by Pwolf » Tue Jul 21, 2009 1:33 am

i guess it's "convert.bat", not "encode.bat" >.> i'm sure you got the point :P


Pwolf

User avatar
hasteroth
lost the bet
Joined: Mon Feb 25, 2008 7:15 pm
Status: Neither here nor there
Location: Around
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by hasteroth » Tue Jul 21, 2009 1:35 am

Fucking awesome.

I need this for my iPod.

Thank you!
<Hacchinya> Stirspeare: ambassador of gaysex
<Stirspeare> Hacchinya: God's own ambassador.

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by Qyot27 » Tue Jul 21, 2009 2:11 pm

Couldn't MediaInfo be accessed to provide the fps detection? The operation could be called against the library or the CLI interface, although I have no idea how difficult that would be. I don't write complex BAT scripts like that, and most of what I use MediaInfo for is to quickly get timestamp readouts, although I have snagged FPS and resolution information for non-MP4/MOV files from it before (for MP4 and MOV I use mp4info, which is part of the MPEG4IP package, in conjunction with mp4box -info).
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by Corran » Tue Jul 21, 2009 2:36 pm

Qyot27 wrote:Couldn't MediaInfo be accessed to provide the fps detection? The operation could be called against the library or the CLI interface, although I have no idea how difficult that would be. I don't write complex BAT scripts like that, and most of what I use MediaInfo for is to quickly get timestamp readouts, although I have snagged FPS and resolution information for non-MP4/MOV files from it before (for MP4 and MOV I use mp4info, which is part of the MPEG4IP package, in conjunction with mp4box -info).
I could use mplayer's own -identify switch to get the fps but the difficulty lies in parsing the output. I'm not sure how to do it in MS-DOS.

User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by Corran » Tue Jul 21, 2009 4:11 pm

Added ability to batch process files. Thanks pwolf. Also added a few more variables to for greater control over encoding.

On the downside, I've removed some of the third-party executables from the zip file. You will need to download them yourself before the batch file will work. I'm not going to help you find them, use a search engine.

Unless there are bugs, this is the final version. I've GPL'ed the batch files so if you want to improve upon it and distribute a modified version, you are more than free to do so.

EDIT: Replaced aacplusenc with nero's aac encoder, as it is a better encoder and easier for everyone else to get a hold of legally. You will need to get neroAacEnc from the nero website.

EDIT: Silent update to fix problems with filenames using exclamation marks.

fobboy
Joined: Tue Dec 26, 2006 2:39 am
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by fobboy » Wed Aug 05, 2009 9:51 pm

I tried running the program, but it doesn't seem to work for me. I've downloaded both the neroAacEnc.exe and the mp4box.exe (from zarx264gui) and placed them in their respective folders within the "Tools" directory. But when I go to run encode.bat it keeps saying "Error mp4box.exe does not exist...". I've tried multiple versions of mp4box.exe (found through google), but none of them work. Can anyone advise me?

User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Re: Converting videos for portable devices (including softsubs)

Post by Corran » Thu Aug 06, 2009 8:27 am

I noticed that you tried sending me a PM, but when I went to my PM box, the private messages panel says: "This message has been removed by its author before it was delivered."

Were you able to solve your problem?

When the "Error mp4box.exe does not exist." message appears, that simply means that the batch file was unable to find MP4Box where it expected to. It has nothing to do with the version of MP4Box you are using.

Please let me know your answers to the following questions:
  • Did you completely copy the folder "ConvertMP4Portable-1.1-Final" from the downloadable zip to some location on the hard drive? The batch file won't be able to run properly if it and the other files and folders are still in the zip.
  • What is the name of your mp4box executable? The batch file expects it to be named "mp4box.exe" and located at ".\tools\mp4box\mp4box.exe". If the file is named differently (i.e. "mp4box-v0.4.5.exe") then the batch won't find the file. The check the batch file performs is case insensitive, meaning both "mp4box.exe" and "MP4Box.exe" are suitable names. The copy of mp4box in Zarxgui is spelled as the batch file expects so this probably isn't your problem since you mentioned using it... (At least if you are using the version currently in the amvapp.)
  • What version of Windows are you using? I've only been testing on Vista up to this point. I have an XP machine I can test on too if necessary.

Locked

Return to “Conversion / Encoding Help”