Development log

Code, tricks, quick technical ideas, recipes, progress reports, bash, ffmpeg and more…

Prepare audio for YouTube with avconv

How to create a video file from a single image and audio track using avconv:

Thanks to a question/recipe from SuperUser:
superuser.com/questions/571100/avconv-video-from-single-jpg-and-ogg

PostScript: make an A6 broshure (8 pages/sheet)

Had this lovely pdf (Music Marketing Handbook, 2007) and had difficulty reading it on screen and wanted to print it in a small (tiny?) broshure format. So, in Linux, I used this:

first convert PDF to postscript file

now the crazy command-line monster (this will take 8 pages in a block, scale them by 0.5, offset their position on a page and rotate four of them upside down):

convert postscript back to pdf, but make sure that GhostView doesn’t try to figure out the correct rotation!

This process will create pages with four pages on each, which you can print double-sided. It is then very simple to fold each of A4 sheets two times and just cut the top two folds.

bookletmaking2
booklet making

Booklet making

Switch CapsLock and Ctrl using xkb

Using CTRL as a modifier is quite frequent, especially in EMACS. Since it is usually (and definitely on my Thinkpad) placed in a position that can cause “Eamcs Pinky”, one of possibilities is to remap CapsLock to another Ctrl. Following a recipe on Emacs Wiki, this is one possible way:

Bash: download from camera and convert to webm

So, M. works on this piece with students of Duncan Centre and SVŠGL, currently in Prague. Later rehearsals will happen in Ljubljana. Anyway, she’s documenting rehearsals on HD camera, which produces HD h264-encoded clips, that are practically unwatchable on her X200 thinkpad. So I wrote a little script that downloads the clips to an external drive and converts them to WEBM format. I think it’s one of the neatest scripts so far from me, as it even uses little error checking (for existence of folders for example).

Continue reading

avconv: replace audio

How to easily replace (faulty/wrong) audio in an video file without re-encoding the whole video? Using “copy” codec for video and -map option to use new audio:

questions and notes (interface fractures research 13/10/07)

At the moment I’m quite inspired by an article in The Wire about Matana Roberts (not a jazz musician, but an experimentalist). Her focus on the past of black slavery and reflection on the present (immigration, LGBT, and more) make me think about my own position and desire to reflect my own past, the past of this country. Slovenians, huh. I’m thinking of slovenian folklore, perhaps a slavic, pagan one on one hand, and about the partisan-communist/belogardist-collaborators issues and conflicts on the other. What kind of people are we Slovenians? Cankar talked about servants, fieldhands, toadies… Cankar is a dark departure point. Slightly halucinogenic. I’m asking myself questions about what are my/our roots which define the most problematic issues in the present? And of course, is there a way to express them, or at least this retrospection and questioning – in a contemporary audio-visual way?

Perhaps I don’t want to be so specific in historic way. Perhaps it would be interesting to think about all those different historic roots, but then move onto a slightly more general feelings, like hate, fascism, xenophobia, … and it seems important to stay honest, to keep a strong connection to what I really stand behind.

I would be looking at:

  • history of slovenia (80s?)
  • histories of art/avant-gardes (Zabel, Šuvaković)
  • theories of fascism, anarchism, critical-culture,
  • philosophy of noise (Voegelin)
  • audio-visual languages (incl. M. Chion), Tscherkassky

I imagine producing textual fragments, visual fragments, 3d structures, sonic fragments – a lot of noise, a lot of bass.

I’m thinking of how different today time is, the precarity, the capitalist exploitation (of workers, of consumers). Is this a new form of fascism? No. Since there is no totalitarian state.(?).

Let’s hold that we are living in informational capitalism. Is it possible to use certain political-artistic strategies from the alternative movements of the 80s in order to reveal the paradoxes of informational capitalism? Jodi Dean.

same old same old: codecs!! (avconv and AAC)

Today I encountered problems with encoding video/audio material due to same old problematic, which so many people seem to not notice but seems that it is oh so important. At least to content creators.

In short, here’s the thing: avconv, the flagship encoder/decoder for most of a/v content (it’s a fork of more famous ffmpeg), now cannot in a simple way encode AAC audio (this is the most common format for h264 mp4 video – or so it seems). In order to have avconv with libfaac encoder (which creates AAC audio) compiling is necessary – without an option to create a deb (if you are on Ubuntu or Debian). That’s quite inconvenient. However, there is an experimental work-around: instead of -acodec libfaac, use ffmpeg/avconv’s own experimental encoder by using -acodec aac -strict experimental.

So here’s the full commandline:

avconv -i INPUTFILE.EXT -s 480x320 -r 25 -b 1000k -bt 1600k -vcodec libx264 -pre:v medium -acodec aac -strict experimental -ac 2 -ar 48000 -ab 128k OUTPUTFILE.mp4

Above was made in order to transcode any video to a format suitable for Waterwheel online platform.

force download in php

People often don’t know how to save a file from a link. You send them a link and it seems just impossible to them to be able to right-click on it and choose “Save link as”. Especially on macs, where the concept of right-click didn’t really exist (and is still unknown to many – it seems). So, how do you help somebody who needs to download a big video file from your server bit it keeps openning in browser in some quicktime player or something. You force the browser to download. Create a PHP file that will send correct headers to browser:

Just take care there are no spaces outside of php tags.

slovenian keyboard layout

While setting up new installation on my laptop (ending up with AVLinux, based on Debian Squeeze and Awesome window manager), there are million little things that don’t work exactly how I want and spend too many hours on fine-tuning it. In fact, one of the things didn’t really manage to setup in the last incarnation of running OS (Ubuntu, Gnome 2) was keyboard layout. So now I managed to do it propertly – the Right Way – by editing some conf files.

So, the basic system to keyboard layouts nowadays is XKB. Layouts that XKB loads are in /usr/share/X11/xkb/symbols. I modified a slovenian layout and added a variant. At the end of /usr/share/X11/xkb/symbols/si I added:

This will give me a layout I can load with setxkbmap si usprog. The basic idea of this layout is that it is a full basic “us” layout with additional ways for three slovenian letters č, š and ž, and “serbo/croat” ć and đ. They are accessible using AltGr (right Alt) key and keys c, s, z, ‘ and d. Simple as that. AltGr + 5 provides an additional Euro currency sign.

The next step would be to create this configuration in a local (under ~/ home) location. A -config option to setxkbmap command should be the way to go, i guess.