May 31st, 2010, 7:19 pm
I record an episode of Dateline NBC because one of my family members wanted to see it, but she wasn’t going to be home to catch the episode. After much fooling around I finally got something that worked well.
So I’m tossing this here in hopes I will remember it and that someone else will find it useful.
The recording was in HD at a resolution of 1920×1280.
mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=6000:keyint=18:trell:aspect=16/9:acodec=ac3:abitrate=224:threads=4 -ofps 30000/1001 -o output.mpg input.mpg
And as another note: When you have a 16/9 video and you scale it to 720×480 (4/3) it will show the full frame to the wide screen tv (making the video look correct) or it will be stretched on a fullscreen television if the dvd player is outputting 4/3 letterbox. If the dvd player is outputting in cropped mode it will cut the extra width of and just show you the 4/3 portion.
^^ – This is how I understand the processes. It may be extremely wrong. If it is and you have a better understanding please let me know!
April 23rd, 2010, 1:33 pm
Well it all began when I started to hear a buzzing noise coming from my server. At first I thought it was the fans, but I quickly found out it was the drive. So I figured I would copy everything to a “spare” drive I had around that was being used for backups. Well no matter what I would do I couldn’t get the motherboard to boot from this drive. Oddly, my eeepc and qemu where able to boot from the drive without a problem.
After six hours of trying to swap drives I gave up. The following weekend I remembered that the boot flag needs to be set on the boot partition to get the bios to boot the drive. Sure enough after setting the boot flag in cfdisk the bios booted the drive without a problem.
The BIOS should look for a mbr. If there is a mbr it should attempt to boot the drive. It shouldn’t care about the partition table at all! From what I know, the boot flag is used by the mbr to determine the boot partition. However, grub nor lilo (both linux boot loaders) care about this flag. The windows mbr is the only bootloader in which the flag matters.
My server has an Intel Little Falls board (D945GCLF) which is only about 2 years old so I was quite surprised when I realized the boot flag had to be set.
March 6th, 2010, 9:03 pm
One of the things that would always irritate me, with Linux, was the fact that I could not resume my machine by hitting a key on the keyboard. When I first searched for an answer, to this issue, many of the replies stated “look for an option in the BIOS.” To my dismay, I had no such option in the BIOS. After more searching I found /proc/acpi/wakeup!
/proc/acpi/wakeup looks like this:
Device S-state Status Sysfs node
UAR1 S4 disabled pnp:00:08
SMB0 S4 disabled pci:0000:00:01.1
USB0 S4 disabled pci:0000:00:02.0
USB2 S4 disabled pci:0000:00:02.1
US15 S4 disabled pci:0000:00:04.0
US12 S4 disabled pci:0000:00:04.1
NMAC S5 disabled pci:0000:00:0a.0
P0P1 S4 disabled pci:0000:00:08.0
HDAC S4 disabled
MXR0 S4 disabled pci:0000:00:10.0
BR11 S4 disabled
BR12 S4 disabled pci:0000:00:12.0
BR13 S4 disabled
BR14 S4 disabled
BR15 S4 disabled
BR16 S4 disabled
BR17 S4 disabled
Now this might be confusing, at first, but do not fear! We are interested in only two types of devices: USB and US
USB0 S4 disabled pci:0000:00:02.0
USB2 S4 disabled pci:0000:00:02.1
US15 S4 disabled pci:0000:00:04.0
US12 S4 disabled pci:0000:00:04.1
To figure out which device is which take the number after pci: and run grep on dmesg. Example for US15: dmesg | grep 0000:00:04.0
You will likely get a lot of output… you should look for something similar (Note: this differs by hardware, it likely won’t be the same)
[ 6.164097] usb usb4: SerialNumber: 0000:00:04.0
[ 7.284302] input: BTC USB Multimedia Keyboard as /devices/pci0000:00/0000:00:04.0/usb4/4-3/4-3:1.0/input/input2
[ 7.284363] generic-usb 0003:046D:C312.0001: input,hidraw0: USB HID v1.10 Keyboard [BTC USB Multimedia Keyboard] on usb-0000:00:04.0-3/input0
[ 7.300110] input: BTC USB Multimedia Keyboard as /devices/pci0000:00/0000:00:04.0/usb4/4-3/4-3:1.1/input/input3
[ 7.300287] generic-usb 0003:046D:C312.0002: input,hiddev96,hidraw1: USB HID v1.10 Device [BTC USB Multimedia Keyboard] on usb-0000:00:04.0-3/input1
As you can see US15 is my USB keyboard so I will simply run echo "US15" > /proc/acpi/wakeup to allow US15 to wake up the computer.
USB0 S4 disabled pci:0000:00:02.0
USB2 S4 disabled pci:0000:00:02.1
US15 S4 enabled pci:0000:00:04.0
US12 S4 disabled pci:0000:00:04.1
If it is not appearant which devices are which there is always the trial and error process. Enable one, see if the desired device wakes up the machine and if it doesn’t, disable the device (by executing the echo command again) and try another.
Lastly just add the echo command to your startup script. On Arch /etc/rc.local is a good place.
March 5th, 2010, 1:14 pm
A few months ago, I was talking to a friend and he wanted to share some files with me. However, we had no easy of doing this. Pondering about the problem, I though it would be great if there was a uploader with some basic user authentication. This brought about the birth of uploader. My biggest problem that I faced was the fact that I had no idea how to work with sessions and sqlite databases. That didn’t stop me though! During winter break and I went to tackle the challenge.
After digging through a lot of examples on the webpy.org website, I was eventually able to throw together something that worked. Winter break ended, the program was usable, and was left, without love, on my server.
Just last week, I started to play with uploader again and I noticed that the code was a disaster and confusing. So I started to rewrite the parts of the code that were bad and added comments. Since I already stumbled with sessions and database objects I had a much better understanding on how they worked and how to implement them into the code. During the last three days I have released uploader.
Github Page: http://github.com/pyther/uploader
Project Page: http://pyther.net/projects/uploader/
Screenshots:
February 26th, 2010, 11:38 am
Webkit has been a piece of software I have been interested with for quite a while. For those who do not know, webkit is a web rendering engine. Safari and Google Chrome are two popular browsers that use webkit as their rendering engine.
Webkit was forked from the KHTML project by Apple in 2002. At the time it was know as WebCore and JavascriptCore. A year later, Apple provided patches to the KHTML project. The KDE team was able to use some of the code, but much of it was poorly documented and the coding style differed greatly. In 2005, Apple opensourced their fork (WebCore and JavascriptCore) as webkit.
I first gave webkit a shot about a year or so ago. I read about midori, a web browser that uses webkit, and I decide to give it a try. Midori was very simple and basic, which I liked and it was faster than firefox. However, webkit would crash a lot when loading/rendering web pages, resulting in midori crashing. Of course nobody likes this and I switched back to Firefox. From that point on, I was impressed with what was going on and tried the combination of webkit/midori every few months.
Over the last year, there have been huge improvements with webkit.
Here is a look at the current status of webkit:
The Good:
- Spell Check support. Let me explain. When spell check support was introduced it would detect misspelled word, but there was no way to see a list of suggestions or pick a suggestion. Before, when a suggestion was picked it would erase the word! Now, it is possible fix the spelling mistake by selecting (highlighting) the word and right clicking. It is a tad bit annoying that the whole word needs be selected, but it something that you get use to.
- Fast: If you thought Firefox was fast, webkit is even faster and it seems to do pretty decent job at rendering javascript quickly too.
- HTML 5 Video: Youtube has deployed HTML 5 videos which only work in webkit based browsers at the moment. There are two file formats for html 5 video: OGG Theora and H264. Mozilla wants ogg theora to become the norm because it is an open and free format, whereas h264 is bound with licensing restrictions and the future is unknown for the codec (will it remain free?). Due to Mozilla stance on the issue and licensing issues, Firefox only works with OGG Theora video clips. Youtube videos are encoded in H264 therefore they won’t work with Firefox. Webkit gets around this issue by using the native operating system’s video player. In the case of linux, webkit uses gstreamer, which results in all videos being processed by gstreamer, not webkit.
- Developer Tools: Although the inspect page/element program needs some work, it has some very promising features. It is similar to firebug, but it also has features that allow you to see what is being stored locally (cookie, session info, etc..), how fast your page is loading, how long each element takes to load, an error console, and a scripts debugger.
- Independent: Webkit is independent from any browser. This makes it much easier to integrate webkit into a web browser. Google chrome, Safari, Midori, Aora, and Uzbl are just a few browsers that use webkit as their rendering backend. As a result, you get developers that will provide patches to Webkit because they want their browser to do x, y, z or render pages better.
The Bad:
- Crashes: Although all web browser crash at some point in time webkit still seems to crash every now and then. Granted, within the last few days I’ve only had one or two crashes, but Firefox and other browsers rarely ever crash (unless if flash is loaded). However, Midori and other webkit browsers can restore the session if their is a crash.
- API: There is still a lot that needs to be done with the API. For example, form auto complete needs to be implemented. Any form auto complete that is seen right now is being implement by the browser (midori, safari, chrome). It would also be nice to get right click spelling to work (without having to select the word). Lastly, the organization of the right click menus could be improved.
- Webpages: There are a handle full of web pages that simply won’t work with webkit right now. The two that come to mind are the University of Akrons Zipline (Student Center, specifically) and Cisco Netacad. Both of these sites use long and complex URLs and the cisco netacad site is built around flash.
Webkit has seen major improvements, but still has a long way to go until it reaches the maturity and stability of other browser on the market. I would consider webkit to be usable on day to day basis providing you don’t have to access one of those overly complex pages that don’t work well with webkit.
Arch Linux AUR Packages:
midori-git: http://aur.archlinux.org/packages.php?ID=14349
libwebkit-nightly: http://aur.archlinux.org/packages.php?ID=34814
January 15th, 2010, 3:22 pm
There is a bug with PacketTracer which seems relatively minor but can cause a lot of frustration to users.
Take me for example: I am taking Cisco 3. It has been 2 years since I took Cisco 1 and 2. The first day in class we were given a review packet tracer file to work on. I forgot to save and when I finally remembered it bit me in the but! I went to save my work and PacketTracer crashed! I lost everything.
Issue: PacketTracer 5.2.1 crashes / segfaults on linux when saving files.
Reason: PacketTracer 5.2.1 is built against Qt 4.4.3. However, it is using the system version of Qt which is likely newer. In my case, I’m using Qt 4.5.3. Many other distributions also use 4.5.3. It appears that there has been a code change between Qt 4.4.3 and 4.4.5; therefore, making 4.4.5 incompatible with PT 5.2.1.
Solution: Have PacketTracer use the qt libs that it ships with.
This can be accomplished with the use of LD_LIBRARY_PATH and a shell script.
#!/bin/sh
export LD_LIBRARY_PATH="/opt/pt/lib"
/opt/pt/bin/PacketTracer5
Adjust the paths as necessary, save the file, and make it executable.
PT might not look as nice and pretty, but it won’t crash!
November 18th, 2009, 9:45 pm
The hard drive in my father’s computer finally died. It was a 74GB Raptor which was originally mine. He wanted to get his computer running as fast as possible, so I hopped on Newegg and ordered a 320GB drive for him.
For kicks, I decided to see if the drive was still under warranty. To my surprise it was! The drive was about 4 years old. I went through the RMA process and just got a replacement a few days ago.
I figured I would use the drive for my / (root), /home, and swap partitions.
However, on my 2x 750GB HDs I had three raid arrays. One for /boot, / (root), and /home. I wanted to make the /home raid array into /data, but I no longer needed /boot or / (root).
Therefore I need to remove the two unneeded raid arrays and expand the last one, /home.
(more…)
November 4th, 2009, 5:37 pm
With Kernel 2.6.26.32-rc6 suspend-2-ram (aka sleep/standby) finally works on my machine! However OSSv4 does not support suspend/hibernate which means that OSS must be unloaded.
This scripts does the following:
- Stop/Start specific Daemons
- Stop/Starts specific Programs
- Informs you of any programs that are preventing OSS from unloading
In my case I have the script stop mpd. Then it kills ossxmix and attempts to unload oss. On spawn it starts mpd again and loads ossxmix.
Here it is:
oss_s.py
#!/usr/bin/env python
import subprocess
import sys
import os
#Daemons that need to be stopped
daemons=('mpd',)
#Programs that are safe to kill
kill_apps=('ossxmix','vlc','mplayer','xine','xmms','audacious',)
#Programs to load on spawn/resume
load_apps=('ossxmix -xb',)
#User to start apps as
user='pyther'
def start():
p=subprocess.Popen(['soundon'])
p.wait()
for d in daemons:
p=subprocess.Popen(['/etc/rc.d/' + d, 'start'])
p.wait()
for a in load_apps:
#Load the program as a user, not root
os.system('sudo su -c \'' + a + ' &\' ' + user)
return
def stop():
for d in daemons:
p=subprocess.Popen(['/etc/rc.d/' + d, 'stop'])
p.wait()
for a in kill_apps:
p=subprocess.Popen(['killall',a])
p.wait()
o=subprocess.Popen(['soundoff'],stdout=subprocess.PIPE)
output=o.stdout.readlines()
list=[]
for line in output:
#If the line is empty skip it
line = line.rstrip("\n")
if line == '':
pass
#Otherwise lets split the line by spaces
else:
line=line.rsplit(' ')
#Going to see if the first word is an int
try:
pid=int(line[0])
except ValueError:
#Must not be an int
pass
#Good it is an int... lets continue
else:
app=line[1] #The second word is the name of the app
#If the list has no values, we will add the first running program
if len(list) == 0:
list.append([pid,app])
#Now lets check and see if the pid is already in the list
else:
inList=0 #Set to False by default
#Scanning items already in the list
#If we find a match we set inList to True and break out of the loop
for x in list:
if int(x[0]) == int(pid):
inList=1
break
if not inList:
list.append([pid,app])
if list:
print("Apps that need to be killed:")
for x in list:
pid=x[0]
app=x[1]
subprocess.Popen(['notify-send', '-u', 'normal', '-i', 'audio-card', '-t', '120000', 'PID: ' + str(pid) + ' is using OSS', str(pid) + ' - ' + app + '\nPlease kill this application.' ])
print("PID: " + str(pid) + " - " + app)
#Exit abnormally
sys.exit(1)
return
if __name__ == "__main__":
if len(sys.argv) <= 1:
print("Usage: start or stop")
sys.exit(1)
if os.geteuid() != 0:
print "You must be root to run this script."
sys.exit(1)
if sys.argv[1] == "start":
start()
elif sys.argv[1] == "stop":
stop()
else:
print "Usage: start or stop"
Usage is simple enough:
./oss_s.py start
./oss_s.py stop
Then to get the script to run on suspend/wake:
Save this as /etc/pm/sleep.d/48oss
#!/bin/bash
case $1 in
hibernate)
/home/pyther/bin/oss_s.py stop
;;
suspend)
/home/pyther/bin/oss_s.py stop
;;
thaw)
/home/pyther/bin/oss_s.py start
;;
resume)
/home/pyther/bin/oss_s.py start
;;
esac
Then make it executable
chmod +x /etc/pm/sleep.d/48oss
Of course you will have to modify the code as necessary.
October 25th, 2009, 1:15 pm
I was asked to convert some European (PAL) dvds to the American (NTSC) format. With the help of a few linux tools, the process is pretty painless. A cautionary note: the process takes about 3 hours for one dvd using my AMD X2 7750.
What you need:
- vobcopy or dvdrip
- projectx
- avidemux
- mplex (part of mjpegtools)
- wine
- dgpulldown.exe (windows app)
- dvdauthor
- dvdxchap (part of ogmtools)
First, we need to rip the DVD to the computer. We can do this by using dvdrip or vobcopy. Vobcoby is a simple command line utility that rips vob files straight from the dvd to the hard drive. dvdrip is a gui tool which is very easy to use. Load it up, create a new project, select the rip tab, and pick the title you want to rip. Ripping the dvd will probably take anywhere from 15-20 minutes.
Vobcopy Example: cd /home/pyther/dvdrip and vobcopy /dev/sr0
Next, we want demux (seperate) the audio and the video. ProjectX is very easy to use for this task and ProjectX insures the video and audio stay in sync.
To Demux the video:
- Start
projectx
- File->Add
- Select all the vob files that were just created
- At the bottom where it says “recent output directories” select “output to same location as 1st file in collection”
- Then click the Quick Start button on the side
This result in the following files being created:
- *.m2v = mpeg 2 video file
- *.ac3 = AC3 Audio File
- *.sub = Subtitle Files
If there are multiple audio tracks you will see zorro-001.ac3, zorro-001[1].ac3, zorro-001[2].ac3
In my case:
- zorro-001.ac3 == Hungarian
- zorro-001[1].ac3 == English
- zorro-oo1[2].ac3 == Directors Comments
Lets clean up the directory right now:
- move *.vob files into a new folder called vob
- move *.sub into a new folder called subs
- Rename the audio files (ex. zorro-001.ac3 -> hu.ac3)
- Remove any audio tracks that you do not want in your remastered dvd (ex. Directors Comments) (more…)
July 25th, 2009, 11:57 am
That’s right I passed the RHCT! Woot!
