Posts Tagged ‘vlc’

VLC Radiostation Bash script

October 17th, 2011 No comments

We use the following script to have our linux machine automatically start playing audio at startup. Every day another radio station will be played with a random choice for some days. It could use some functions to make it a bit tidier, but I’m satisfied with it at this point. 🙂

# Arrow Classic Rock
# City FM
# QMusic
# Eagle FM
#current day of week, 0 is sunday
curr_day_of_week=$(date +%w)
case $curr_day_of_week in
                let "number %= ${#radio_stations[@]}"
                /usr/bin/vlc ${radio_stations[$number]}
                /usr/bin/vlc ${radio_stations[0]}
                /usr/bin/vlc ${radio_stations[1]}
                /usr/bin/vlc ${radio_stations[2]}
                /usr/bin/vlc ${radio_stations[3]}
                let "number %= ${#radio_stations[@]}"
                /usr/bin/vlc ${radio_stations[$number]}
                let "number %= ${#radio_stations[@]}"
                /usr/bin/vlc ${radio_stations[$number]}
Categories: Linux Tags: , ,

Converting media for your PS3

August 26th, 2010 No comments

According to the PS3 site the following media can be played:

The following types of files can be played under (Video).

    * Memory Stick Video Format
    - MPEG-4 SP (AAC LC)
    - H.264/MPEG-4 AVC High Profile (AAC LC)
    - MPEG-2 TS(H.264/MPEG-4 AVC, AAC LC)
    * MP4 file format
    - H.264/MPEG-4 AVC High Profile (AAC LC)
    * MPEG-1 (MPEG Audio Layer 2)
    * MPEG-2 PS (MPEG2 Audio Layer 2, AAC LC, AC3(Dolby Digital), LPCM)
    * MPEG-2 TS(MPEG2 Audio Layer 2, AC3(Dolby Digital), AAC LC)
    * MPEG-2 TS(H.264/MPEG-4 AVC, AAC LC)
    * AVI
    - Motion JPEG (Linear PCM)
    - Motion JPEG (μ-Law)
    * AVCHD (.m2ts / .mts)
    * DivX
    * WMV
    - VC-1(WMA Standard V2)

Supported audio formats:

    * Memory Stick Audio Format(ATRAC)
    * MP3
    * - MPEG-1/2 Audio Layer3
    * - MP3 Surround
    * MP4(MPEG-4 AAC)
    * WAVE(Linear PCM)
    * WMA

I tested several encodings on my Quad-core Intel (Q6600). I got the best results encoding with the MP4 format as all four cores were used at 100%. This also resulted in smaller file sizes.
I am using VLC to do the conversion although other programs (ffmpeg, mencoder) might also work mighty fine.

The goal I had was to transcode movies add subtitles and keep file sizes as small as possible so we can put them on an external usb storage device for playback.

We will use VLC from the command-line. The following commands are useful. Have a look at the man pages for more information. VLC command-line pages

This is the command I ended up with:

vlc "movie.avi" --sub-file="" --sout=#transcode{vcodec=h264,acodec=mp4a,vb=0,ab=192,channels=2,soverlay,audio-sync}:standard{access=file,mux=mp4,dst="outputfile.mp4"} vlc://quit

You can add “-I dummy” if you don’t want/need a window to pop up. I like it because it shows where you are in the transcoding process.
The soverlay is used for the subtitles. I limit the audio channels to 2 because I don’t have any surround sound setup. Change it to whatever you need.

I also happen to have a full hd camera which has a sensor in the format 1440×1080. These pixels have an aspect ratio 4:3 (PAR) which results in getting movies with 1920×1080 resolution. (Full HD) To be able to play these movies on my PS3 I convert them with FFMPEG. I have built FFMPEG from source on my linux machine because I need libx264 to encode the videos. The command I then use to get PS3 compatible movies is:

ffmpeg -i Moviename.MOV -sameq -vcodec libx264 -vpre slow -crf 22 -acodec libfaac -ab 128k Moviename.mp4

Modify the command as needed. Above line gives me good quality and decent file sizes.