Friday, November 18, 2011

Fix FFMpeg to Convert Audio

When trying to use FFMPEG to convert AC3 audio in a video file to AAC, I kept receiving the error message "Unknown encoder 'libfaac'." Finally I found the solution to this on Ubuntuforums.org. FFMPEG that comes with Ubuntu has no proprietary non-free codecs included. Instead of recompiling FFMPEG, simply install Medibuntu repositories, the install additional codec libraries. From the Medibuntu site:

The following bash command adds Medibuntu's repository to Ubuntu. It also adds Medibuntu's GPG key to your keyring, which is needed to authenticate the Medibuntu packages.

This command should be run in the Terminal (Applications → Accessories → Terminal):

sudo -E wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update

Medibuntu's repository is deactivated by upgrading to a newer Ubuntu release, so you should run this command again after the release upgrade.

You may also wish to add the following packages. The first will cause many apps from the Medibuntu repository to appear in Ubuntu Software Center (Ubuntu 9.10+) or Add/Remove Applications (versions prior to 9.10). The second will allow users to generate crash reports against Medibuntu packages and submit them to the Medibuntu bugtracker.

sudo apt-get install app-install-data-medibuntu apport-hooks-medibuntu 

Wednesday, October 19, 2011

Droid 2 SBF, Factory Data Reset

To SBF:
  1. Install RSDLite (I used 4.9) in Windows.
  2. Install latest Motorola drivers if not already installed.
  3. Download SBF file you desire (stock Froyo in my case VRZ_955_2.3.20.zip, then extract to SBF file).
  4. Sync Google data and backup anything you don't want to lose.
  5. Turn Droid 2 off.
  6. While holding the up key on the slide-out keyboard, power the phone on. It will go to a black screen with some low-res white text.
  7. Connect the phone to the PC with RSDLite using USB.
  8. At the RSDLite file box, browse to the location of your SBF file and choose it.
  9. Click "Start"
  10. It'll take about 5-7 minutes. When it gets near 100%, hold a finger over the up key on the slide-out keyboard.
  11. When the flash reaches 100% in RSDLite and it briefly states it is rebooting your phone, press and hold the up key while it reboots.
  12. After it reboots, watch in RSDLite for the message at the right reading "PASS." Now you can close RSDLite, shut phone off, and turn back on.

The first time I tried this from Squidly back to stock Froyo, it worked. When it rebooted, I had to reactive my phone by dialing *228 and choosing option 1. Then I was able to receive the OTA Gingerbread update from Verizon.

The second time I needed to do this a few months later, before taking my phone in for possible warranty replacement, I got the "PASS" but when booting up normally, it always got stuck in a boot loop at the droid red light. I always had to pull the battery. Finally, I had to boot to the recovery menu by holding down the "x" key on the slide-out keyboard while powering up the phone. After booting that way, I saw a triangle with a "!" inside. At that screen, press the search key (I used the magnifying glass key on the slide-out). That brings it to the recovery menu where the volume keys can be used for navigation and the camera key to choose. I chose "factory data reset." It returned me to brand-new, out-of-the-box configuration with Froyo 2.2. I had to step through activating the phone, etc. just like when it was new. Then I went to Settings, About Phone, System Updates. That started the OTA Gingerbread update. After the long download, it installed and rebooted successfully to a stock OTA Gingerbread.

Now, if desired, it can be rooted with Pete's Droid 3 Linux root script, then install ROM Manager, then download and install whatever replacement ROM using ClockworkMod Recovery directly or simply using the option in ROM Manager.

Monday, October 10, 2011

Generate SSH Key on Linux for Android

If you need to generate an SSH key pair on your Linux PC for your Android device (i.e. ConnectBot or AndFTP), here's how I did it.

ssh-keygen -b 2048 -C Droid2 -t rsa -f id_rsa_droid2

Then the private key only needs to reside on the Android device (then import into software that needs it), and the contents of the public key need to be added onto the .ssh/authorized_keys file on every remote host you desire to ssh into from the Android device. One way is to get the public key file on the remote host, then enter

cat id_rsa_droid2.pub >> .ssh/authorized_keys

(the ">>" says to append the contents of id_rsa_droid2.pub to the end of the authorized_keys file)

If I find a better way—for example generating an OpenSSH-compatible keypair on the actual Android device—I'll post it.

Wednesday, October 5, 2011

Removing Subtitles With MKVMerge

If you have subtitles in an MKV file that you want gone, you don't have to re-encode the whole thing. Simply open in MKVMerge, choose the track you want to remove (the text track if you want to remove subtitles), uncheck it, and remux. It'll take a few seconds and won't re-encode everything else. While there, you may want to make sure Compression is set to "none" explicitly on the extra options tab for each track to ensure maximum compatibility with things such as PS3, etc.

Making Compatible MKVs with MKVMerge

The following tip is from StephenB on the netgear forums. It helped me a lot. Thanks, Stephen.

Original Thread Title: Re: No sound on .MKV files , increasing in frequency.

It is the Muxing mode : Header stripping. This is also called "header compression". Though it doesn't save enough space to matter.

For some reason the Matroska developers made this mode the default earlier this summer. It doesn't work with most hardware players (including the EVA and also the WD Live).

You have to re-process the files to remove the header compression. This doesn't hurt the quality at all, and is a pretty fast operation. If you are comfortable running command line tools, you can either use mkWDclean.exe (found at https://sourceforge.net/projects/mat...7.zip/download) or MKVMerge (found at http://www.videohelp.com/tools/mkvtoolnix)

The command line strings are:

mkWDclean input.mkv output.mkv
mkvmerge -o output.mkv --compression -1:none input.mkv

There are two other ways that don't require opening a command line shell:

(a) You can use MKVMerge GUI, but it is tedious. You select every track (from the middle pane), select the "extra options" tab, and set user defined options to "--compression -1:none". (blank is not good enough).

(b) You can download VID2EVA from http://vid2eva.lefti.net. This is a freeware video conversion tool that I've put together. After installation you right click on the MKV and select "VID2EVA" then "transcode audio". For this particular file, it won't transcode since the audio is already AC3. But it will remove the header compression.

Sunday, March 20, 2011

Rename Photos With Exiftool

There are a lot of usage examples for the powerful command line interface utility called Exiftool by Phil Harvey http://www.sno.phy.queensu.ca/~phil/exiftool/ but it took me a while to figure out the exact syntax to accomplish what I wanted to do. The following renames files (you can specify all writable files in a directory name at the end of the command, a pattern based on wildcards like *.JPG, or even one specific file) to something like 2011-02-20_03-05-41-1_NIKON D40.JPG (where filename is composed of date, time, "-" counter (the "." in the "%%-.c" causes the counter to start display "0" for non-duplicate filenames), EXIF Model tag, and original extension. THIS COMMAND DOES NOT LEAVE THE ORIGINAL FILENAME (it is like a "mv" not a "cp") :

exiftool '-FileName<${DateTimeOriginal}_$Model.%e' -d %Y-%m-%d_%H-%M-%S%%-.c ./DSC_1703.JPG

Yes, the filename has a space in it because the EXIF Model tag has a space in it, but if you're like I am and don't want spaces, it's easy enough to cleanse all the spaces from your filenames (in this case, with underscores) using the following command:

rename 's/ /_/g' *.JPG

Other tags besides Model can be used, too; I happen to want my filenames with Model in them. Of course one can combine these into one shell script called something like rename-myphotos.sh. It could look something like this:

#! /bin/bash
#
# Rename photos to something like:
# 2011-02-20_03-05-41-1_NIKON D40.JPG where filename is composed
# of date, time, "-" counter (the "." in the "%%-.c" causes the
# counter to start display "0" for non-duplicate filenames), EXIF
# Model tag, and original extension. THIS COMMAND DOES NOT LEAVE THE
# ORIGINAL FILENAME (it is like a "mv" not a "cp")
#
# Can replace ./ at end with directory name, filename, or filename
# pattern with wilcards.
#
# REMOVE "-n" FROM "rename" AND ADJUST FILENAME PATTERN AT END OF
# THAT LINE AS NECESSARY

exiftool '-FileName<${DateTimeOriginal}_$Model.%e' -d %Y-%m-%d_%H-%M-%S%%-.c ./
rename -n 's/ /_/g' ./

Wednesday, March 16, 2011

Easy CLI Commands for CD-ROM

To get information about CD media in a drive:

cdrecord -atip

To record a CD ISO image (i.e. the latest Linux release):

cdrecord -v the-filename.iso

Note: wodim is interchangeable with cdrecord.
Note: You may have to specify your optical drive by including, for example, /dev/cdrom in the above commands.