Mar 092013
 

Here are the commands to issue in order to crop and/or cut a movie file with ffmpeg:

# cutting:
ffmpeg -i [input_file] -qscale 0 -ss [start_seconds] -t [duration_seconds] [output_file]
# so for example:
ffmpeg -i BSX234.avi -qscale 0 -ss 00:00:30.0 -t 00:00:10.0 cut-BSX234.avi

# cropping:
ffmpeg -i [input_file] -vf crop=[w:h:x:y] -b 600k -r 10 -vcodec mpeg4 [output_file]
# so for example:
ffmpeg -i [input_file] -vf crop=320:480:160:0 -b 600k -r 10 -vcodec mpeg4 [output_file]

# combined cutting and cropping:
ffmpeg -i [input_file] -qscale 0 -ss [start_seconds] -t [duration_seconds] -vf crop=[w:h:x:y] [output_file]

# Here are some other useful commands:
# or
ffmpeg -ss 00:00:30.0 -t 00:00:10.0 -i [input_file] -acodec copy -vcodec copy -async 1 output.wmv
Jan 192013
 

Creating a video from JPEGs

I wrote a Bash script for this purpose:

It first renames the images from something like IMG_9999.JPG, IMG_10000, … to IMG_00001.JPG, IMG_00002.JPG. Then it reduces the image resolution down to FullHD (1920×1080). The last and most important step: Create a video from the images.

Extracting JPEGs from video

Extract 250 high quality JPEGs from the movie file MVI_7655.MOV starting at the time 02 minutes, 13 seconds and save them to ../series/img-001.jpg, ../series/img-002.jpg, ../series/img-003.jpg:

ffmpeg -i MVI_7655.MOV -ss 00:02:13 -vframes 250 -f image2 -qscale 1 ../series/img-%03d.jpg

References

Dec 132012
 

You probably know this problem, if you own a DSLR yourself. You take a lot of images in combined RAW+JPEG mode, then trash bad shots by checking the JPEGs on your computer. In the end, the RAW images (*.CR2 for my Canon EOS DSLR) are left over in the same folder. This was the reason why I wrote this Python script: remove-orphaned-raw-images.py :

You can use the bash to run this cleanup script in every subfolder of your picture library top folder:

Nov 232012
 

Rotating videos is a task that’s not that uncommon if you’re filming with your camera in upright position. You can easily do this with ffmpeg:

ffmpeg -i in.mov -vf "transpose=1" out.mov

The command line tool ffmpeg is available for all major operating systems (I’m using it on Mac OS X; I installed it via Homebrew).

Resources

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Nov 132012
 

I found this solution on StackOverflow which worked for me on Windows 7:

  • Install Python (currently I’d use Python 2.7).
  • Add C:\Python27\Scripts to your %PATH% environment variable in order to be able to use Python and the the programs without naming the full path.
    Read more about this here
  • Install easy_install: Get it here.
  • Use easy_install to install pip:
    easy_install pip
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Nov 122012
 

Elegant code to print a hex string in python:

toHex = lambda x:"".join([hex(ord(c))[2:].zfill(2) for c in x])

# you can use it like this:
print [toHex(byte) for byte in '\x03\xac23\n']
# it should print
# ['03', 'ac', '32', '33', '0a']
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Sep 192012
 

We use the modules 8752 and 8753.

List of commands

Common Commands

Syntax Command Manual Page
AIN <device> <channel> Read/Display Analog Input 61
DEF Load Default Parameters 62
DIAG <driver> Display Diagnostics Byte from Device 62
IN <device> <channel> Query State of Digital Inputs 89
LOCK Lock Out Other Input Devices 63
MAP <joystick-device>=<driver> Set/Display Device-to-Joystick Mappings 64
OUT <device> <channel>=<value> Set Digital Output 65
SAV Save Parameters 65
UNLOCK Unlock Other Input Devices 66
VER Query Firmware Version 66
Jun 142012
 

I wrote a converter for Wikidot syntax that outputs Markdown syntax. You can use it to move from Wikidot.com to any Markdown based wiki / blog / note collection.

I set up an online converter that you can use to convert your Wikidot syntax files to Markdown.

The converter itself is written in Python and I published it on Github: wikidot-to-markdown.

The converter does not cover the full Wikidot syntax and features yet. If you would like another feature to be supported, fork the project on Github and implement it, or contact me about it.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Apr 102012
 

What you have to do:

  1. Remove the staples of your leaflet.
  2. Create a new folder for your images to scan.
  3. Scan the batch of leaflet pages as PNG image files.
    1. First scan the outer pages starting with the cover.
    2. Then scan the inner pages starting with the cover.
  4. Run the script convert.sh (see above) in the folder containing the *.PNG images.
  5. Staple the leaflet again.
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)