Author Archives: pxnh

Aw, snap! Fixed (for me)

…So recent builds of Chromium for Linux kept crashing as soon as I started the browser. I waited for a solution to appear, but it seems only a handful of (random?) people get these kind of crashes.

Running Chromium from the command line revealed something was wrong, it said:
libva info: VA-API version 0.37.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/nouveau_drv_video.so
libva info: va_openDriver() returns -1
[3465:3465:0904/210107:FATAL:sandbox_seccomp_bpf_linux.cc(203)] Check failed: policy->PreSandboxHook().
[3438:3460:0904/210107:ERROR:browser_gpu_channel_host_factory.cc(121)] Failed to launch GPU process.

So I headed to http://kurtextrem.github.io/ChromiumFlags/ and then to http://www.chromium.org/developers/how-tos/run-chromium-with-flags and then to http://peter.sh/experiments/chromium-command-line-switches/#disable-seccomp-filter-sandbox until I ran:

chromium --disable-seccomp-filter-sandbox

…And then no more snapping!

Edit:
https://code.google.com/p/chromium/issues/detail?id=527209
http://thread.gmane.org/gmane.comp.web.chromium.bugs/1508910

Advertisements

Convert .ape files to multiple .mp3 (or .ogg, or .flac, or…)

If you want to convert an .ape file to multiple files in other formats, in Linux you can do:
ffmpeg -i input.ape output.wav
(the above command will convert the track to .wav, a lossless conversion)
bchunk -w output.wav input.cue track
(the above command will split the tracks, one in each file)

Now you can convert the resulting files using the encoder you like (lame, oggenc, flac…):
oggenc track*.wav
for i in track*.wav ; do lame "$i" "$i".mp3 ; done
for i in track*.wav ; do flac "$i" "$i".flac ; done

Shared folder in QEMU

Call qemu with the option -net user,smb=/tmp, or add this option in AQEMU’s Advanced -> QEMU/KVM Window options. The drive will be accessible on 10.0.2.4/qemu.

If your guest is a Windows machine, you can then map that location as a network drive (“\\10.0.2.4\\qemu“).

For this to work, you have to launch the Samba process yourself.

Combine multiple PDFs on Linux

As written here, you can do:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH 1.pdf 2.pdf 3.pdf

.ps (postscript) zoom with psutils on Linux

Since the man pages are a bit too short, here are the magic recipes to zoom a postscript document (for example, you need less/more margins on print):

    • 20% zoom:

pstops '1:0@1.2(-2cm,-2.5cm)' input.ps output.ps

    • 30% zoom:

pstops '1:0@1.3(-3cm,-3.5cm)' input.ps output.ps

The @1.2 (or @1.3) part zooms while the (-2cm,-2.5cm) (or (-3cm,-3.5cm)) part centers the page.


There is also pdfcrop (for pdf files), it comes with tetex.

Extract a split zip archive on Linux

You have filename.{z01,z02,...,zip}. You need to do:

zip -s- filename.zip -O fixed.zip

… and then extract from fixed.zip with unzip (see man unzip).

If that doesn’t work, you can try with:

cat filename.{z01,z02,...,zip} > temp.zip && unzip temp.zip

Slackware-current: post 13.1 notes

akonadi/nepomuk – 30 nov 2010

akonadi/nepomuk started barfing, and I couldn’t use kmail anymore. I think kde-pim (or maybe akonadi only?) needs to be recompiled since libboost was upgraded and akonadi was searching for the wrong .so file. Temporary fix:

    # ln -l /usr/lib/libboost_program_options.so.1.45.0 /usr/lib/libboost_program_options.so.1.42.0

[Update (30 nov 2010): akonadi was rebuilt]

…then came nepomuk. kmail couldn’t find it. Of course, I disabled it, since I didn’t use it, but now it needs to be enabled even if you don’t care, because kmail evidently needs it. So, to quote the akonadi troubleshooting page:

Please try enabling it in System Settings under Advanced -> Desktop Search -> Basic Settings by checking “Nepomuk Semantik Desktop” and clicking “Apply”.

…and there you go. kmail is back. But I’m going to search for alternatives soon.

ffmpeg/mplayer tricks

[These are here just as a little reminder for me…]

Convert a .flv file (from youtube, for example) to .avi (for your home player)

    ffmpeg -ab 192k -ac 2 -sameq -i file_input.flv file_output.flv.avi

Convert a .flv file (from youtube, for example) to .mp3 (for your mp3 player)

    ffmpeg -i file_input.flv -ar 44100 -ab 160k -ac 2 file_output.mp3

Convert a .flv to .ogg:

    mplayer -ao pcm:fast:file=file.wav -vo null input_file
    oggenc -b 160k -o output_file.ogg file.wav

or:

    oggenc -q2 file.wav

Swap audio channels in mplayer:

    mplayer -af channels=2:2:0:1:1:0 input_file

Deinterlace with mplayer:

    mplayer -vf pp=fd input_file

or (maybe better?):

    mplayer -vf pp=ci input_file

SATA of love

If you happen to see something like the following in your /var/log/syslog:

    ata1: EH in SWNCQ mode,QC:qc_active 0x1 sactive 0x1
    ata1: SWNCQ:qc_active 0x1 defer_bits 0x0 last_issue_tag 0x0
    dhfis 0x1 dmafis 0x1 sdbfis 0x0
    ata1: ATA_REG 0x41 ERR_REG 0x84
    ata1: tag : dhfis dmafis sdbfis sacitve
    ata1: tag 0x0: 1 1 0 1
    ata1.00: exception Emask 0x1 SAct 0x1 SErr 0x300000 action 0x6 frozen
    ata1.00: Ata error. fis:0x21
    ata1: SError: { Dispar BadCRC }
    ata1.00: failed command: READ FPDMA QUEUED
    ata1.00: cmd 60/08:00:85:5d:03/00:00:3a:00:00/40 tag 0 ncq 4096 in
    res 41/84:00:85:5d:03/84:00:3a:00:00/40 Emask 0x10 (ATA bus error)
    ata1.00: status: { DRDY ERR }
    ata1.00: error: { ICRC ABRT }

… it might simply be a loose SATA cable. You can get rid of those nasty messages simply unplugging and plugging back the loose cable. Or you can try another SATA port, if your motherboard has a free one.

Other messages you might see are similar to the following:

  • res 41/84:00:15:e4:67/84:00:39:00:00/40 Emask 0x10 (ATA bus error)
  • dhfis 0x1 dmafis 0x1 sdbfis 0x0
  • ata1.00: Ata error. fis:0x21
  • ata1.00: cmd 60/00:00:45:4a:bc/01:00:38:00:00/40 tag 0 ncq 131072 in
  • ata1.00: error: { ICRC ABRT }
  • ata1.00: exception Emask 0x1 SAct 0x1 SErr 0x300000 action 0x6 frozen
  • ata1.00: failed command: READ FPDMA QUEUED
  • ata1.00: limiting speed to UDMA/100:PIO4
  • ata1.00: status: { DRDY ERR }
  • ata1: ATA_REG 0x41 ERR_REG 0x84
  • ata1: EH in SWNCQ mode,QC:qc_active 0x1 sactive 0x1
  • ata1: SError: { Dispar BadCRC }
  • ata1: SWNCQ:qc_active 0x1 defer_bits 0x0 last_issue_tag 0x0
  • ata1: limiting SATA link speed to 1.5 Gbps
  • ata1: tag 0x0: 1 0 0 1
  • ata1: tag : dhfis dmafis sdbfis sacitve

rtmp:// retrieval with rtmpdump and tcpdump

Some sites now use the rtmp protocol to stream videos, using primarily Flash in a web browser as a client.

rtmpdump is a utility created to save those videos on disk for later use. Since its usage is a bit obscure and the download could fail for various reasons (a missing option, a badly spelled parameter, etc.) and every site needs its own tweaks, I’m going to explain a bit how to deal with the simple cases.

Some of the parameters needed to run rtmpdump correctly could be viewed by looking at the html code of the web page: look for the strings “mp4”, “config”, “player”, “rtmp” (maybe in uppercase too); those are usually written as javascript parameters, or found in a .xml “config” file. To find this “config” file, a plugin like “live HTTP header” for Firefox may be useful.

tcpdump could be needed, unless you want to dig into disassembling a Flash application (but maybe a simple strings can be enough), since some variables are not shown in the html code of the web page.

The simplest usage for tcpdump, for our purposes is (as root, assuming eth0 is your network device):

    tcpdump -w file.tcpdump -s 0 -i eth0

Then you can load the page with the video you are interested in. After some seconds, you can stop tcpdump with ctrl-C. Now you can look at what your network interface was doing by doing something like:

    /usr/sbin/tcpdump -A -n -s 0 -r file.tcpdump | less

As before, you should search for “mp4”, “config”, “player”, “rtmp” and similar. If you find a string like

    rtmpe://example.net/application/somepath/filename.mp4

you can go on and try immediately if this works:

    rtmpdump -r rtmpe://example.net/application/somepath/filename.mp4 -o filename.mp4

If this doesn’t work, run the same command with the “-V” (verbose) option. If you see something like “Application (application) is not defined”, it means that rtmpdump didn’t parse correctly the url you gave. That’s because (as written in the rtmpdump manpage)

The url should be of the form

    rtmp[t][e]://hostname[:port][/app[/playpath]]

…but since the code can correctly parse the url only if it’s quite simple, sometimes it can make a wrong guess, and that’s where the user should be explicit about every part of the path, and use the corresponding options (like --app or --playpath).

Still, this could be not enough: some streams require some kind of “autentication” (well, kind of), so more fiddling with options is needed. Some of the more useful options are:

    −−pageUrl (URL of the web page in which the media was embedded)
    −−swfVfy (URL of the SWF player)
    −−token (Key for SecureToken response, used if the server requires SecureToken authentication)

The first, −−pageUrl, is obvious. For the second, all is needed is a look at the html source. The third is sometimes written in the .html page too, or sometimes in an .xml configuration file called either by the web page or the flash code: that’s where tcpdump or “live HTTP headers” become useful.

Another method, maybe simpler, but sometimes not perfect, involves the use of iptables and rtmpsrv, as explained in this blog post:

  • Redirect the outgoing traffic on the rtmp port to localhost:
      iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT
  • Start rtmpsrv on localhost
  • Load the page containing media streamed over RTMP
  • Now rtmpsrv should print a line on screen. You can stop it with CTRL-C, and close your browser
  • Remove the traffic redirection:
      iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT

Note: if you don’t want to install anything, but just try it out just after compiling it, you’d better compile with:

    make SHARED=

…then you can run everything locally:

    ./rtmpsrv

UPDATE:
I found out that there’s a bug somewhere, so rtmpsrv doesn’t always work: sometimes the page containing the stream won’t reload. To hack around this problem:

  • Redirect the outgoing traffic on the rtmp port to localhost:
      iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT
  • Start rtmpsrv on localhost
  • Load the page containing media streamed over RTMP
  • Now the page seems stuck loading the stream, and rtmpsrv doesn’t show anything yet: if so, reload the web page
  • Now rtmpsrv should print a line on screen. You can stop it with CTRL-C, and copy this line somewhere: you have to edit it
  • Start rtmpsuck on localhost
  • Load the page containing media streamed over RTMP
  • Now rtmpsuck should print some informations on screen. You can stop it with CTRL-C, and copy this info somewhere: you have to use it to make the line given by rtmpsrv work
  • Remove the traffic redirection:
      iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT

Now you have to compare the output of rtmpsuck, like:

… with the one of rtmpsrv and change the command line parameters one by one. Maybe this won’t get you much far, the download may stop before it reaches 100%, but can be useful anyway. Good luck.