Archive for ‘Linux’ Category

If you try to install Ubuntu 10.10 under parallels desktop 6.0 on OSX — atleast as of the writing of this article — you’ll soon discover that although your entire installation is done in a high (eg: 1920×1080) resolution, as soon as the install is done and you reboot, your VM is stuck at 1024×768. You can install the parallel tools using the menu option and it still won’t help — although it helps with 3D (ie: compiz). Under Gnomes System/Preferences/Monitors the highest resolution available is 1024×768 :-(. After searching around the net for the past week or so and trying just about every remedy — which did not work — I was about to give up, then I found the magic command that “makes it go” :-).

I’ve now got Ubuntu 10.10 running with PT/compiz under parallels 6.0 @ 1920×1080. No problem. Normally if you go inside ~/.config/ directory (.config folder under your home directory) you’ll notice that there is no “monitors.xml” file in there. That’s the per user X config file that gets the ball rolling. Generating the file is really easy. Open a teminal and issue the following command:

xrandr

This will generate (hopefully) the following output:

Note that 1024×768 is the default. Now if you go inside ~/.config/ directory you’ll find a “monitors.xml” file (below). Once you’ve got this file you can go to System/Preferences/Monitors and choose the higher resolution options (eg:1920×1080). The xrandr command should generate the file for you. If it doesn’t (not sure why), here is my version for parallel 6.0. I think it’s pretty generic so you should be able to cut and paste the content:

<monitors version="1">
  <configuration>
      <clone>no</clone>
      <output name="default">
          <vendor>???</vendor>
          <product>0x0000</product>
          <serial>0x00000000</serial>
          <width>1920</width>
          <height>1200</height>
          <rate>60</rate>
          <x>0</x>
          <y>0</y>
          <rotation>normal</rotation>
          <reflect_x>no</reflect_x>
          <reflect_y>no</reflect_y>
          <primary>no</primary>
      </output>
  </configuration>
</monitors>

Fixing Plymouth (boot splash) in Ubuntu 10.10 aka. Maverick Meerkat

datePosted on 14:10, November 1st, 2010 by Many Ayromlou

If you’ve recently installed Ubuntu 10.10 and have installed Nvidia and/or ATI drivers — or installed ubuntu under emulation — you’ll end up with a (butt) ugly splash screen. In my case under parallel 6.0 I ended up with a text boot screen that just read “Ubuntu 10.10″……Ughhh. Here is a quick tutorial on how to get a nice splash restored. This procedure also works in 10.04. Keep in mind that I’m doing everything with 1280×1024 screen size. your mileage might vary (ie: you might want 1024×768). You’ll need to get a terminal session opened for this:

  • Get the nice splash screen installed
    sudo apt-get install v86d
  • Edit your grub config file and add the following
    sudo vi /etc/default/grub
  • Look for this line:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
  • and replace it with this (note: 1280×1024 screen res…..your mileage might vary):
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset video=uvesafb:mode_option=1280x1024-24,mtrr=3,scroll=ywrap"
  • Still in the same file look for this line:
    #GRUB_GFXMODE=640x480
  • and replace it with this (note: 1280×1024 screen res…..your mileage might vary):
    GRUB_GFXMODE=1280x1024

Your /etc/default/grub file should look like this once you’re done (partial screenshot):

  • Save the file and issue the following command to start editing /etc/initramfs-tools/modules file:
    sudo vi /etc/initramfs-tools/modules
  • The file should be mostly commented out. At the end of the file insert the following line (note: 1280×1024 screen res…..your mileage might vary):
    uvesafb mode_option=1280x1024-24 mtrr=3 scroll=ywrap

Your /etc/initramfs-tools/modules file should look like this once you’re done:

  • Save the file and issue the following command:
    echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash
  • Finally issue the following two command to update grub:
    sudo update-grub2
    sudo update-initramfs -u

Reboot and Enjoy :-)

How to stream live HDV/DV to iphone…..

datePosted on 13:36, March 5th, 2010 by Many Ayromlou

In this guide I’ll show you how to stream live HDV/DV video to your iphone using a linux box (Ubuntu 9.10) with firewire input running vlc/ffmpeg and a Imac with OSX 10.6.2 running mediastreamsegmenter and apache2.

Start out with the iPhone streaming media overview. Without understanding this document you’ll have a hard time getting things working.

First things first, you need to have a working Ubuntu 9.10 machine. I’m using a small footprint 2.4Ghz Core2Duo machine with PCI firewire 400 card in it. For video input I’m using a Canon HV30 set to HDV mode (1080i/60) connected via firewire.

Next you need to follow the instructions on this page (steps 0-5) to get a working ffmpeg with x264 and aac encoding. Without this working you’re not going anywhere….sorry. If you’re trying this on a different Ubuntu installation follow the other links to get a working ffmpeg setup.

Then install vlc using “sudo apt-get install vlc“. I used vlc as my encoder frontend as I understand it better than ffmpeg. You can use just straight ffmpeg as well if you can figure out how to get it to encode the live HDV stream over firewire.

You’ll also need dvgrab utility. Install it using “sudo apt-get install dvgrab“.

Now we want to make sure the internal firewire module is working so type this command and see if you get a vlc window with the camera output in it (make sure you turn the camera ON and hook it up first).
sudo dvgrab -f hdv -noavc -nostop -|vlc -
You have to use sudo under ubuntu to get proper access to the firewire device. The above command runs dvgrab with hdv format and makes sure that 1394 AV/Device control is turned off (this way you can be in Camera mode and get a live feed). The nostop switch prevents dvgrab from sending stop commands to the camera everytime you stop it via Ctrl-C, which I though was a good thing. The last dash forces dvgrab to output to stdout, which we’ll then pipe into vlc (the dash for vlc tells it to use stdin as input).

Next we need to create a media stream out of our linux box and ship it over UDP to the Imac. The vlc command below gets the job done. Remember you’re sudo’ing and need to provide the password after you enter the command.
sudo dvgrab -f hdv -noavc -nostop -|vlc - --sout '#transcode{vcodec=h264,vb=256,venc=x264{aud,profile=baseline,level=30,keyint=30,bframes=0,ref=1,nocabac},acodec=mp4a,ab=64,scale=0.25,deinterlace,width=320,height=240}:duplicate{dst=std{access=udp,mux=ts,dst=192.168.1.97:1234}}'
The IP address toward the end of the command is the IP of the Imac machine receiving the stream. Port 1234 is arbitrary. The stream is comprised of h.264 video @ 256K and AAC audio @ 64K. Those elementary streams are then packaged in mpeg2 transport stream before being shipped to the Imac. This is the standard way of doing HTML5 video (from what I understand).

So now we can go over to the mac and see if we receive the video stream. For that just run VLC for OSX and open UDP network port on port 1234 (udp://). If things are working nicely you should see a 320×240 video from you HDV camera on the Imac.

Now that we have the video on the mac, we need to use the “mediastreamsegmenter” command line tool to create HTML5 video stream out of it. mediastreamsegmenter listens on a UDP port for incoming transport stream chops it (by default) into 10 sec. “mini” transport stream files and writes these mini files to wherever you tell it. This location is important since it needs to be accessible to your webserver. Remember, at the end of the chain (day), the webserver is doing all the heavy lifting of delivering the mini transport stream files to your iphone. mediastreamsegmenter also produces a file of type .m3u8
which is basically a live updated playlist.

Something you might not know is that apple ships standard OSX with apache builtin. All you have to do is use the following command to get it started.
apachectl start
Now point your browser on the mac to localhost and see if it loads a page. Now that apache is working we need to modify it so it knows how to deal with .ts and .m3u8 files. This involves adding a couple of lines to /etc/apache2/httpd.conf
AddType application/x-mpegURL .m3u8
AddType video/MP2T .ts

and /etc/apache2/mime.types
.m3u8 application/x-mpegURL
.ts video/MP2T

Next we need to restart apache
apachectl restart
By default OSX apache is setup to load it’s documents from /Library/WebServer/Documents, so I created a directory called “stream” to contain the media stuff (.ts files and .m3u8 file) and put the following into the index.html file in /Library/WebServer/Documents.
<html>
<head>
<title>Video Test</title>
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
</head>
<body style="background-color:#FFFFFF; ">
<center>
<video width='320' height='240' src="prog_index.m3u8" controls autoplay> </video>
</center>
</body>
</html>

Now that we’ve got all the prep done on the mac, we issue the following command from terminal window to get the mediastreamsegmenter going (details can be found by using man mediastreamsegmenter).
mediastreamsegmenter -b http://192.168.1.97/stream -f /Library/WebServer/Documents/stream 192.168.1.64:1234
Here -b specifies the base of the URL that will be encoded into the .m3u8 file (this is the IP address of your Imac, stream is the folder in /Library/WebServer/Documents/ where the mini .ts files and the .m3u8 file are). The -f switch specifies the output directory for the mini .ts files and the .m3u8 file. and the last IP address:port is from your Linux box.

Now you should be able to open up your browser on your iphone/ipod touch and punch in http://192.168.1.97 (assuming the Imac is reachable from your phone) and see the streaming video (You might have to turn on “Plugins” feature under settings/safari on your device. Mine was turned off and drove me crazy until I figured it out). If Plugins is turned off, the index.html page will load, but no video.

Hopefully there is enough meat here to get you guys started……btw. I hear the following command (or variations of) can be used on linux side (instead of vlc). I haven’t tried it and can’t confirm if it works.
ffmpeg -i <in file> -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320×240 -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4×4+partp8×8+partb8×8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 <output file>

Some excellent information can be found on Carson McDonald’s blog:

123... 242526PreviousNext