Using HandbrakeCLI to create MP4
Both of these use Handbrakecli.exe which is Handbrake's command line interface bundled with Handbrake when you install it. Handbrakecli.exe is, as you might guess, used in the command line (or console, or bash depending on your system).
1. To rip a DVD (or video file) and compress it to MP4:
HandbrakeCLI.exe -i d:\video_ts\ -o videofile.mp4 -b 1200 -B 128 -v -O -d
Explanation starting at the beginning:
Handbrakecli.exe tells the computer to run handbrakecli.exe based on all of the options that follow. NOTE:if you are not in the folder that contains handbrakecli then you need to put in the full path to it - something like "c:\Program Files (x86)\Handbrake\handbrakecli.exe"
-i [options] is the input video/device/folder
-o [options] is the output video file (mp4)
-b [options]is the video bitrate. 1200 is large enough for good quality video. My low quality encodes use -b 800 and sometimes -w 320 which sets the width of the video to 320 (SD is 720 and HD is 1080 or 1440)
-B [options] is the audio bitrate. 128 is CD quality.
-v is...I can't remember
-O optimizes the video for online streaming - it lets you load the beginning of the video before the other parts of the video. Think YouTube with it's loading bar. BTW that is a capital O as in ho ho HO <--
-d deinterlaces the video. Old home movies and some other SD sources usually need this. I use it as needed.
2. Here's a LIFE SAVER I came across and retooled for my collection.
To convert an entire collection of .avi (or other file types) files to .mp4 you can create and run this batch file:
FOR /F "tokens=*" %%G IN ('DIR /B /S *.avi') DO "C:\Program Files\Handbrake\HandbrakeCLI.exe" -i "%%G" -o "%%G".mp4 -b 1200 -B 128 -v -O -d && DEL "%%G"
To use this, open a notepad document, paste the text above into it and then save as converttomp4.bat. Move the .bat file to the folder where the files reside and then run it (double click). WARNING: THIS WILL DELETE THE ORIGINAL FILE!
The explanation of this is too much for here. The main thing you need to know is that where it says *.avi tells the computer to go (loop) through all of the .avi files in the folder and then DO everything after the word DO. %%G is the variable which carries the name of the current file it is working on so after && you can see it says DEL %%G. This deletes the current file after it is converted.
Other stuff:
For a long time I resisted using Handbrake because of it's Apple slant but, since the Bassett Channel, I have used it almost exclusively for my video conversions. Mind you, this is only for converting TO MP4 which is the current trend in compressed quality videos. The phrase 'current trend' is what inspired me to share the information above because I am in the process of converting MY ENTIRE digital video library over to MP4 and I thought others might like to know how I'm doing it. So here you go.
handbrakecli is Handbrake's Command Line Interface and, for some reason, it rips, converts, and compresses faster than just about anything else I've used. Not only that but it gives you as much or as little control over the conversion as you might want/need. The handbrake UI didn't work for me because the presets weren't exactly what I was looking for and, rather than navigate all of the menus and try to figure out what "Optimized for viewing online" meant I just went to the core of the system and have been much happier...but that doesn't mean you will be...
In any case, I hope this helps all you videophiles out there and, again, let me know if you've got questions or need any help.
Richie
Showing posts with label file. Show all posts
Showing posts with label file. Show all posts
Wednesday, July 11, 2012
Sunday, May 16, 2010
How to use Kindlegen to create ebooks for your Kindle
Apparently, this has been a pretty popular article so I decided to provide a quick overview if you just want the fast, dirty steps for using kindlegen. If you would like some more detail then read the further explanation below.
1. Get kindlegen here: http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000234621
2. Unzip the files to the folder where you keep your ebooks (it's really much easier that way)
3. Open your command line and point to the folder containing your ebooks and kindlegen.
4. Enter the command 'kindlegen.exe ebook.html' where ebook.html is the name of the ebook you want to convert. note: in order for kindlegen to make the conversion the file must be in html format.
5. Move the newly created .mobi file to your kindle's ebook directory
6. Enjoy a favorite book or new adventure that you've converted yourself :)
For some reason (not so difficult to imagine) there appears to be no simple explanation of how to use Kindlegen on the internet. This amazed me since I would think lots of people would want to convert and add their own ebooks to the Kindle. Kinlegen can be used to do just that. The catch is, it is only available in the command line. This may be intimidating for some but I guarantee it's not that difficult once you understand how it works. Here's what to do.
1. Get the latest version of kindlegen from Amazon's website (available here at the time of writing this article: http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000234621 )
2. Unzip the files to a chosen location
3. At this point your options open up considerably. You can create a very basic book or a very complex book depending on how dirty you want to get with HTML and XML coding. Among the unzipped files you'll find a folder called 'Sample' that contains a complex book (the Kindle User's Guide) with all of the supporting files that would be needed to create it, you can review how this is all set up if you like. For now, I'm going to just go over the basic book option in order to keep this short. If you would like more in depth info on how to create a complex book (linking images and table of contents, etc.) go ahead and comment or email me directly.
4. Okay, in order to create a simple ebook for the kindle you'll need an HTML file of your ebook. If you go to Project Gutenberg (gutenberg.org) you can download a TON of out of copyright books in HTML format. You can also use PDFs or txt files you've purchased but you'll need to convert them to html (you can use PDFtoHTML and txt2html respectively to do so). Okay, once you have the HTML file, do yourself a favour and put it into the same folder as Kindlegen.
5. Now, open up your command line. In Windows, go to Start > Run and enter cmd then press enter. In Linux, you should be able to find the terminal under Accessories or some other main menu option. Once open, navigate to the location of Kindlegen.
e.g. C:\Documents and Settings\myname\My Documents\ebooks\Kindlegen\
If you are not familiar with a command line then you are probably in Windows and can get there by entering
c:
cd..
cd Documents and Settings\myname\My Documents\ebooks\Kindlegen
6 Once your command line is pointing to the folder where you have kindlegen and the HTML file (we'll call it ebook.html in our example but you would put in the name of the HTML file you are converting) all you have to do is type
kindlegen.exe ebook.html
For some reason in Linux I had to enter the exact file path so it would be something like this:
/media/disk/Documents/ebooks/kindlegen/kindlegen /media/disk/Documents/ebooks/kindlegen/ebook.html
7. You'll notice that a new file is created in the directory called ebook.mobi. Connect your Kindle to your PC and drop the file into the same folder as your other ebooks.
8. Eject your Kindle, disconnect it and then start the Kindle. If you've done everything correctly you should see the ebook now available in your home screen.
Congrats, you can now take any HTML file you have available to you and create your own ebook for reading on the Kindle. Cheers!
Oh, as a final note - Again, you could get much more in depth in the process and use an OPF and NCX file but you should only need that if you are getting serious about publishing. You can open Kindlegen's help by simply typing kindlegen.exe or kindlegen without any filename following it. This will bring up all of the kindlegen options. Happy reading!
1. Get the latest version of kindlegen from Amazon's website (available here at the time of writing this article: http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000234621 )
2. Unzip the files to a chosen location
3. At this point your options open up considerably. You can create a very basic book or a very complex book depending on how dirty you want to get with HTML and XML coding. Among the unzipped files you'll find a folder called 'Sample' that contains a complex book (the Kindle User's Guide) with all of the supporting files that would be needed to create it, you can review how this is all set up if you like. For now, I'm going to just go over the basic book option in order to keep this short. If you would like more in depth info on how to create a complex book (linking images and table of contents, etc.) go ahead and comment or email me directly.
4. Okay, in order to create a simple ebook for the kindle you'll need an HTML file of your ebook. If you go to Project Gutenberg (gutenberg.org) you can download a TON of out of copyright books in HTML format. You can also use PDFs or txt files you've purchased but you'll need to convert them to html (you can use PDFtoHTML and txt2html respectively to do so). Okay, once you have the HTML file, do yourself a favour and put it into the same folder as Kindlegen.
5. Now, open up your command line. In Windows, go to Start > Run and enter cmd then press enter. In Linux, you should be able to find the terminal under Accessories or some other main menu option. Once open, navigate to the location of Kindlegen.
e.g. C:\Documents and Settings\myname\My Documents\ebooks\Kindlegen\
If you are not familiar with a command line then you are probably in Windows and can get there by entering
c:
cd..
cd Documents and Settings\myname\My Documents\ebooks\Kindlegen
6 Once your command line is pointing to the folder where you have kindlegen and the HTML file (we'll call it ebook.html in our example but you would put in the name of the HTML file you are converting) all you have to do is type
kindlegen.exe ebook.html
For some reason in Linux I had to enter the exact file path so it would be something like this:
/media/disk/Documents/ebooks/kindlegen/kindlegen /media/disk/Documents/ebooks/kindlegen/ebook.html
7. You'll notice that a new file is created in the directory called ebook.mobi. Connect your Kindle to your PC and drop the file into the same folder as your other ebooks.
8. Eject your Kindle, disconnect it and then start the Kindle. If you've done everything correctly you should see the ebook now available in your home screen.
Congrats, you can now take any HTML file you have available to you and create your own ebook for reading on the Kindle. Cheers!
Oh, as a final note - Again, you could get much more in depth in the process and use an OPF and NCX file but you should only need that if you are getting serious about publishing. You can open Kindlegen's help by simply typing kindlegen.exe or kindlegen without any filename following it. This will bring up all of the kindlegen options. Happy reading!
Subscribe to:
Posts (Atom)