cue/flac file splitting

i received a lossless CD that was encoded in FLAC with a cue file. which means it’s one big file and since my old MP3 player does understand FLAC i still wasn’t able to play one song out of many because cue files aren’t supported.

here’s how you can split them into seperate files

install shntool and flac cli tools

sudo apt-get install shntool flac

then just use cat and shnsplit to split the file and create correct file names:

cat file.cue | shnsplit -o flac -t "%n-%t" file.flac

this will output the tracks as “tracknumber-trackname.flac”

if you also install vorbis-tools you can easily create ogg files almost the same way

cat file.cue | shnsplit -o "cust ext=ogg oggenc -q 6 -o %f -" -t "%n-%t" file.flac

(using a quality setting of 6)

and at last create the tags for the files like this

cuetag file.cue *.flac

or

cuetag file.cue *.ogg

respectively

apple blocking trailers for non quicktime users

well the apple trailer site is actually a pretty nice resource for watching new trailers… up until a few weeks ago!

apple has been so nice to start blocking trailer play for users that do not have quicktime installed, so everybody on linux has been locked out of watching trailers directly on the site.

the good thing though is that there’s always a solution (and in this case it’s pretty simple) to this kind of nonsense!

on most apple trailer pages you see the size button for the trailers on the right side… if you copy the url for let’s say the medium video you should get something like this:

http://movies.apple.com/movies/independent/ihopetheyservebeerinhell/ihopetheyservebeerinhell_h.480.mov?width=480&height=204

so to watch this video just open a shell and use mplayer.

  • first we need a user agent to trick apple into serving us the movie file. after some research i found that
    'QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)'

    works nicely.

  • second we need to strip the size parameters from the url which would result in
    http://movies.apple.com/movies/independent/ihopetheyservebeerinhell/ihopetheyservebeerinhell_h.480.mov
  • third since we are streaming the movie let’s add a little buffer so mplayer can seamlessly play the file. in my example i chose 2048

so if we put this all together… the command would be

mplayer -cache 2048 -user-agent 'QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)' http://movies.apple.com/movies/independent/ihopetheyservebeerinhell/ihopetheyservebeerinhell_h.480.mov

and there we go, watching the trailers again…

[EDIT]
changed my code to include linux as the os ;)

mplayer -cache 2048 -user-agent 'QuickTime/7.6.2 (qtver=7.6.2;os=`uname -or`)' http://movies.apple.com/movies/independent/ihopetheyservebeerinhell/ihopetheyservebeerinhell_h.480.mov

transcode could not find a FFMPEG codec for ‘mpeg2video’

to create a dvd out of different videos i often use transcode, for example:

transcode -i input.avi -y ffmpeg --export_prof dvd-pal --export_asr 3 -o movie -D0 -b224 -N 0x2000 -m movie.ac3 -J modfps=clonetype=3 --export_fps 25

after an update (don’t recall what and when) i recently started getting this error:

[export_ffmpeg.so] Could not find a FFMPEG codec for 'mpeg2video'.
[transcode] warning : (encoder.c) video export module error: init failed
[transcode] critical: failed to init encoder

i found that libav received a stripped version in the official repository. so i checked the multiverse repos and they have the unstripped version there. so uninstall these packages:

libavcodec51
libavdevice52
libavformat52

and replace them with these:

libavcodec-unstripped-51
libavdevice-unstripped-52
libavformat-unstripped-52

and your transcoding can continue!

time lapse: convert single jpg images to a movie

since they’re tearing down the buildings in front of our office and there’s been a cool webcam positioned near the site i wrote a little script to get the images and wanted to convert them into a time-lapse…

here’s the knowledge i gained from this little experiment.

first i thought that image magick could do the trick, i noticed that to create a mpeg2 video i needed a little encode program that i found here.
compiled this and moved it to /usr/bin

then i executed convert in my image directory

convert -delay 10 *.jpg m2v:time_lapse-test.mpg

the output was a nice little motion jpeg which i couldn’t use in my little video software called open movie editor (there’s probably better stuff out there but this is the first one i found and tried and seemed simple)

so i tried the ffmpeg approach

ffmpeg -r 5 -i %12d.jpg -y -an time_lapse-test.mpg

which i didn’t get working at all since the regex type image path just didn’t seem to find any images… so i gave up quite quickly.

so the next try was mencoder (should’ve tried this to begin with since mplayer/mencoder can just about do anything)

mencoder -ovc lavc -mf fps=3:type=jpg 'mf://*.jpg' -o time_lapse-test.avi

the result was a bad quality video… so i started using some params to get this sorted out

using this as help i tried “-ovc copy”, which was great and gave me a 1 to 1 copy of the jpegs

mencoder -ovc copy -mf w=800:h=371:fps=6:type=jpg 'mf://*.jpg' -o time_lapse-test.avi

great!! … i’m back at the mjpg which i can’t use in open movie editor!

so let’s encode it into some other video codec… i installed x264 and tried:

mencoder mf://*.jpg -mf w=800:h=371:fps=15:type=jpg -ovc x264 -x264encopts subq=5:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b:qp_constant=26 -o time_lapse-test.avi

and i just didn’t get it to work without having to compile things… so i gave up once more ;)

some more research and after testing a few different bitrates, this is what gave me good results:

mencoder -nosound mf://*.jpg -mf w=800:h=371:type=jpg:fps=15 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2160000:mbd=2:keyint=132:v4mv:vqmin=3:lumi_mask=0.07:dark_mask=0.2:mpeg_quant:scplx_mask=0.1:tcplx_mask=0.1:naq -o time_lapse-test.avi

the important things here is setting the frames per second to 15 and the codec to mpeg4 with a bitrate of 2160000. everything else was gathered on different sites and really almost make no difference (in what you see at least)

so then i quickly edited movie… and saved it, it was way too big so encoded it again but this time with 2 passes and a smaller bitrate:

mencoder -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=1620000:mbd=2:keyint=132:v4mv:vqmin=3:vlelim=-4:vcelim=7:lumi_mask=0.07:dark_mask=0.10:naq:vqcomp=0.7:vqblur=0.2:mpeg_quant -mf type=sgi:fps=25 -nosound -o /dev/null time_lapse-test.avi

to generate the divx2pass.log then in the second pass i also added the mp3 music:

mencoder -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbitrate=1620000:mbd=2:keyint=132:v4mv:vqmin=3:vlelim=-4:vcelim=7:lumi_mask=0.07:dark_mask=0.10:naq:vqcomp=0.7:vqblur=0.2:mpeg_quant -mf type=sgi:fps=25  -audiofile "/home/me/music.mp3" -oac copy -o time-lapse_216k_mp3.avi time_lapse-test.avi

and there you have the final movie!

delete divx2pass.log and upload to youtube :)

oh yeah… and added some meta tags

ffmpeg -title "destruction time-lapse" -author "munzli" -comment "www.munz.li" -acodec copy -vcodec copy -i time-lapse_162k_mp3.avi time-lapse_162k_mp3_meta.avi

and here you have it (needs to be high quality because compressed it looks even worse)

[edit]
well youtube blocked my video saying that a copyright owner has claimed it owns some or all of the audio content in my video. oh well the music industry is just something you shouldn’t support! just don’t understand why you can’t have a little video online that even mentions the music at the end and might even bring a song to a wider audience!

i encourage everybody to use riaaradar before purchasing their next album!

mythtv with mantis and DVB-S2 (TechniSat SkyStar HD2 continued…)

well thanks to awf and his comment i checked out mythtv (the release-0-21-fixes branch) and applied this patch, compiled and it kinda works.

that was the short version, here’s the longer one:

check out mythtv
svn co http://svn.mythtv.org/svn/branches/release-0-21-fixes/

download this patch right here and apply it from the mythtv folder using
patch -p0 < mythtv_multiproto.5.patch

then make sure you've got all the qt3 development libraries, the XvMC development libraries aswell as LAME and all the others (don't quite remember the whole list) but if you compile you'll find out what your missing.

to configure i used awf's parameters described in his post
./configure --enable-xvmc --enable-dvb --disable-hdhomerun --disable-firewire --enable-xvmc-opengl --enable-opengl-video --enable-opengl-vsync --enable-proc-opt --extra-cxxflags=-I/path/to/mantis/linux/include --extra-cflags=-I/path/to/mantis/linux/include
of course don't forget to correct the path to the mantis driver build.

of course now
make
sudo make install

then configure mythtv using mythtv-setup.

awf was nice enough to send me the dtv_multiplex table (which contains all the transport information for hotbird 13°E and astra 19.2°E) and so i went on to channel scanning... have all the hotbird channels... but can't scan astra eventhough i think i've got the disecq settings correct! if i look into the database it has my card and the inputs doubled, i can delete everything and it recreates them like that. soooo, a little help on the diseqc settings would be greatly appreciated ;)

of course if anybody want's the dtv_multiplex for hotbird and astra i'll gladly send it to you since it did help me out a lot! (of course if awf is cool with that)

thanks a bunch for the comments left here they helped out alot!

UPDATE: ok, got the astra channels scanned too. thanks to awf who pointed out Western union fees that i needed two video inputs (right now both set to EIT Western union fees that 's why i thought one wouldn't make a difference).

it scans ASTRA HD+ and ANIXE HD but it can't get a lock on both channels through mythtv. so the multiproto myth patch is still missing something or does anybody else have a good idea?

howto run a TechniSat Skystar HD2 on linux

since i’m switching from my analog WinTV-PVR-500 to a DVB-S setup in my mythtv box I installed a TechniSat Skystar HD2 card (a rebranded Azurewave AD SP400 CI VP-1041) and to my surprise I got it running fairly quickly.

here’s a description on the first steps i took in creating a mythtv box with DVB-S and hopefully DVB-S2.

install mercurial (distributed version control system). In debian based systems:
sudo apt-get install mercurial

then obtain the latest mantis multiproto drivers. there is no patching necessary for the card to run.
hg clone http://jusst.de/hg/mantisthen compile and install.
make
make install

more info can be obtained here under “Method 2”.

the modules can be loaded manually but to test the correct loading a reboot is easier. now the card should be loaded at boot.

to create a channels.conf you’ll need scan from the dvb-apps located on linuxtv.org.
the way to get this working quite easy is described here. the TerraTec Cinergy S2 PCI HD CI is another clone of the same card.

make sure that the changed line in the Makefile has the correct path. in the example it is
CPPFLAGS += -I/usr/src/mantis/linux/includebut since i compiled in my home directory my path was different (this is quite obvious but i thought i’d state it to be sure).

EDIT:i noticed that scan with the patch don’t work anymore… it should work just using the compiled scan in the dvb-apps/utils directory!

while running scan:
./scan dvb-s/Astra-19.2E > ~/.szap/channels.confcheck to see if these lines (or any stating: Using ‘STB0899 Multistandard’ DVB-S2) appear.
----------------------------------> Using 'STB0899 Multistandard' DVB-S2
Tune to frequency 11914500
DVB-S IF freq is 1314500
0x0006 0x0081: pmt_pid 0x0062 PREMIERE -- PREMIERE HD (running, scrambled)
0x0006 0x0082: pmt_pid 0x0063 PREMIERE -- DISCOVERY HD (running, scrambled)
0x0006 0x0084: pmt_pid 0x0065 BetaDigital -- ANIXE HD (running)
0x0006 0x0083: pmt_pid 0x0064 BetaDigital -- ASTRA HD+ (running)
then you know that DVB-S2 is working also! yay!

afterwards i had 1187 services only on Astra 19.2E. half of them scrambled but hey, the numbers count ;)

now to test the whole thing enter the dvb-apps/test directory and try zapping to a channel (check in the ~/.szap/channels.conf to see which number is good to go and not scrambled).
./szap2 -r -n 085
the output will show you some channel data and as soon as “FE_HAS_LOCK” is displayed (keep szap running) open mplayer in a different terminal
mplayer /dev/dvb/adapter0/dvr0
and you should see a picture! alright, the card is up and running!

all seems good but i still have a problem with DVB-S2. and that is as soon as i’m trying to display a DVB-S2 channel like ANIXE HD (channel #550 in my channels.conf)
./szap2 -r -t 2 -n 550i get a “FE_HAS_LOCK” but mplayer then just returns:
TS file format detected.
VIDEO MPEG2(pid=1535) AUDIO A52(pid=1539) NO SUBS (yet)! PROGRAM N. 0

and that’s it…

i think i’m missing some codecs or something (w32codecs,DeCSS, x264, etc. is installed).
any help is appreciated though ;)

NOTE: don’t forget to add the option “-t 2” for DVB-S2 for szap

UPDATE: i noticed that when i zap to a HD station and wait long enough i get this error right after the “TS file format detected”:
Too many audio packets in the buffer: (4096 in 7340032 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
MPEG: FATAL: EOF while searching for sequence header.
Video: Cannot read properties.

so i’m still unsuccessful at watching HD tv.

UPDATE 2!!: to watch HD tv stations you need the option -p when calling szap2!
-p : add pat and pmt to TS recording (implies -r)

so try
./szap2 -r -p -t 2 "ASTRA HD+" and open mplayer… wow

my 3GHz system that’s gonna be the mythbackend sometimes quits with mplayer saying:
************************************************
**** Your system is too SLOW to play this! ****
************************************************
which means… my frontend system is gonna have to be upgraded!

amr sounds in 3gp videos

well ubuntu out of the box doesn’t support amr sounds often found in mobile phone videos. the problem is that ffmpeg isn’t compiled with amr support… medibuntu has a version compiled with amr support, so….

add a medibuntu repository file:
sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list

this creates a new source list in the sources.list.d folder and leaves your main source file unchanged.

then also add the GPG key:
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update

this is also described on the medibuntu page.

you should get an update notice and if not it should be sufficient to update the libavcodec1d (ffmpeg codec library).

now your mobile phone 3gp videos should play with sounds.

canon g7 fun…

playing around with my canon g7 again… from 4am ’til about 6:30am we went out on friday night (saturday morning would be more correct) and shot about everything possible…

we had more fun than a barrel of monkey with just a lighter and some long time exposures!
long time exposure

like mentioned in my old post this is not an SLR camera, but it’s macro abilities and everything up to exposure times are amazing!

replacing the display of your iAudio X5

well i ruined my display and finally was able to get a new one.

the X5

since i thought it was no biggie to replace myself i started disassembling my X5.

step 1

after opening the next step was removing the hard drive.

step 2

i had to complety remove everything to reach the display.

disassembled X5

the replacement display in place i put it together to check if it worked. i wasn’t carefull enough so i had to solder the battery cable back on, because i accidentally tore it off (so be careful if you plan on doing something like this too).

and when i turned on the device the backlight seemed to work but my display didn’t. :(

testing the display

looks like i’m gonna have to send it in for repair anyway since the display controller seems to be broken too. always fun to look into electronic devices though ;)