Affichage des articles dont le libellé est command-line. Afficher tous les articles
Affichage des articles dont le libellé est command-line. Afficher tous les articles

lundi 26 février 2007

Write GPS data on your photos with Exiftool

Exiftool is a Windows/Mac command-line app (or a muti-plateform Perl librairy) to read and write EXIF metadatas on certain file types.

In the following I will use .jpg files from my camera and the Windows .exe version of Exiftool that I will control in a DOS shell.

Want to see some EXIF metadata in your picture ?

$ exiftool mypicture.jpg

Want to extract the precise date and time when this picture was taken ?

$ exiftool -CreateDate mypicture.jpg
( Returns something "2007:02:10 21:19:43")

Want to write your picture was on the Eastern part of Greenwich meridian ?

$ exiftool -GPSLongitudeRef="E" mypicture.jpg

Want to write the exact the longitude value ?

$ exiftool -GPSLongitude="7.422809" mypicture.jpg

Want to write your picture is in the northern latitudes ?

$ exiftool -GPSLatitudeRef="N" mypicture.jpg

and give the exact latitude value ?

$ exiftool -GPSLatitude="48.419973" mypicture.jpg

Obviously you can combine the four tags above in just one line.

You can check everything went well with another exiftool mypicture.jpg (warning: if the app. doesn't understand what to do it didn't return me any error message by default ).

More informations about the GPS tags can be found here.

With this Free Software GPL command-line version it's now easy to integrate geolacalisation capabilities in a Python script for example.

I can upload my pictures on Flickr and they will show on the Flick maps but I still need to use the geocoding bookmarklet if I want to add the geotagged tags and the google maps.

PS: -n option gives you the latitude/longitude in the decimal form when reading these tags
PS: Python also have a nice similar library but I didnt' succeed to write GPS data with it,
http://www.emilas.com/jpeg/

samedi 16 décembre 2006

[Win] Command line : recording a live video from a webcam or another video device

I use Microsoft Windows Media Encoder 9 Series which is free as in beer (I didn't need to download the free SDK).

In "Program Files\Windows Media Components\Encoder" it installs in particular a script called WMCmd.vbs.

You can run this script with cscript.exe which should already be in "Windows\system32" :

cscript.exe WMCmd.vbs -adevice X -vdevice Y -output C:\test.wmv -duration Z

where,

X= the number of the audio device (I used 1 in my case for my webcam)
Y= the number of the video device (I also used 1 for my webcam here)
Z= the duration in seconds (you can always kill the process on the go if the video is shorter)

For command-line options type "cscript.exe wmcmd.vbs" in the shell.

If I want the video to be shorter than the given duration and want to control this from a Python script I use the DOS taskkill command.

More informations also here.

jeudi 7 décembre 2006

[Win] Video/Audio conversion with MMconvert

I'm searching for a tool to convert videos on Windows (in particular wmv) in a more open format. I also need a command line control (for later Python scripting).

A quick search on SourceForge brings me a first tool : MMconvert

In its installation folder there are MMconvert.exe (for command line) and MMConvertGUI (with a GUI ...)

The GUI version:

- choose the video container in "Video Operations" (I have avi, wmv,mkv)
- "add" one or more video to convert
- select the video and audio codecs to use, "ok" -> "execute"

Command line version:

Let say I want to convert my wmv into a matroska (mkv).

First I check for the audio and video codecs that I have on my computer (and that I can use with this container):
MMconvert.exe /f:mkv /lv
MMconvert.exe /f:mkv /av

This commands gives a list of codecs I can use for the matroska container (just remember the associated number, X and Y in the following).

To convert the video:
MMconvert.exe if=test.wmv of=test.mkv /f:mkv /v:X /a:Y

Memo:
if= input file
of=output file
f=format (for the container: avi,wmv,mkv...)
v=video
a=audio

To know more about the aguments : mmconvert.exe /?

It looks like a great tool but I haven't found yet if I can hide the little "Status windows" in command-line mod. I don't see either if I can play with the bitrate