Archive

Posts Tagged ‘ps3’

PS3 Bluetooth Remote with XBMC on Linux

January 14th, 2013 No comments

SONY DSC
 
 
 
 
 
I used my PS3 bluetooth remote for a while to control my XBMC. But not all keys were mapped because by default the device is mapped as a HID device with only several buttons mapped to actual keys. I found this great howto to be able to use and program all buttons on the remote. Follow the basic steps there to build and install the bdremote driver.

I needed to modify several scripts a bit and added an extra script to be able to log the battery level. (And maybe in the future send some sort of notification when it is almost empty)
 
 
 
 
 
I modified the rc.local script a bit:
(Make sure you set your ID correctly, eg: 00:00:00:00:00:00)

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
 
service bluetooth stop
sleep 1
/usr/local/bin/bdremoteng -a 00:00:00:00:00:00 -p 8888 -t 600 -b /home/yourusername/scripts/battery_change.sh &
sleep 1
mkdir /var/run/lirc
/usr/sbin/lircd -H null --connect 127.0.0.1:8888
sleep 1
service bluetooth start
ln -s /var/run/lirc/lircd /dev/lircd
exit 0

Used the default Lircmap.xml (~/.xbmc/userdata/Lircmap.xml):

<lircmap>
  <remote device="SonyBDRemote">
        <obc101>1</obc101>
        <obc102>2</obc102>
        <obc103>3</obc103>
        <obc104>4</obc104>
        <obc105>5</obc105>
        <obc106>6</obc106>
        <obc107>7</obc107>
        <obc108>8</obc108>
        <obc109>9</obc109>
        <obc110>0</obc110>
        <obc111>enter</obc111>
        <obc112>up</obc112>
        <obc113>right</obc113>
        <obc114>down</obc114>
        <obc115>left</obc115>
        <obc116>circle</obc116>
        <obc117>stop</obc117>
        <obc118>pause</obc118>
        <obc119>ps</obc119>
        <obc120>prev</obc120>
        <obc121>next</obc121>
        <obc122>play</obc122>
        <obc123>scanrev</obc123>
        <obc124>scanfwd</obc124>
        <obc125>cross</obc125>
        <obc126>eject</obc126>
        <obc127>select</obc127>
        <obc128>l3</obc128>
        <obc129>r3</obc129>
        <obc130>start</obc130>
        <obc131>l2</obc131>
        <obc132>r2</obc132>
        <obc133>l1</obc133>
        <obc134>r1</obc134>
        <obc135>triangle</obc135>
        <obc136>topmenu</obc136>
        <obc137>time</obc137>
        <obc138>square</obc138>
        <obc139>return</obc139>
        <obc140>clear</obc140>
        <obc141>popup</obc141>
        <obc142>steprev</obc142>
        <obc143>stepfwd</obc143>
        <obc144>subtitle</obc144>
        <obc145>audio</obc145>
        <obc146>angle</obc146>
        <obc147>display</obc147>
        <obc148>blue</obc148>
        <obc149>red</obc149>
        <obc150>green</obc150>
        <obc151>yellow</obc151>
  </remote>
</lircmap>

And I modified the keymap (~/.xbmc/userdata/keymaps/remote.xml) a bit:

<keymap>
 
  <global>
    <universalremote>
        <obc101>Number1</obc101>
        <obc102>Number2</obc102>
        <obc103>Number3</obc103>
        <obc104>Number4</obc104>
        <obc105>Number5</obc105>
        <obc106>Number6</obc106>
        <obc107>Number7</obc107>
        <obc108>Number8</obc108>
        <obc109>Number9</obc109>
        <obc110>Number0</obc110>
        <obc111>Select</obc111>
        <obc112>Up</obc112>
        <obc113>Right</obc113>
        <obc114>Down</obc114>
        <obc115>Left</obc115>
        <obc116>PreviousMenu</obc116>
        <obc117>Stop</obc117>
        <obc118>Pause</obc118>
        <obc119>XBMC.ActivateWindow(ShutDownMenu)</obc119>
        <obc120>SkipPrevious</obc120>
        <obc121>SkipNext</obc121>
        <obc122>Play</obc122>
        <obc123>Rewind</obc123>
        <obc124>FastForward</obc124>
        <obc125>Info</obc125>
        <obc126>XBMC.EjectTray()</obc126>
        <obc127>Playlist</obc127>
        <obc128>XBMC.updatelibrary(video)</obc128>
        <obc129>XBMC.updatelibrary(music)</obc129>
        <obc130>Queue</obc130>
        <obc131>VolumeDown</obc131>
        <obc132>VolumeUp</obc132>
        <obc133>PageUp</obc133>
        <obc134>PageDown</obc134>
        <obc135>ContextMenu</obc135>
        <obc136>ShowVideoMenu</obc136>
        <obc137>XBMC.ActivateWindow(settings)</obc137>
        <obc139>PreviousMenu</obc139>
        <obc140>BackSpace</obc140>
        <obc141>ContextMenu</obc141>
        <obc142>StepBack</obc142>
        <obc143>StepForward</obc143>
        <obc144>xbmc.activatewindow(pictures)</obc144>
        <obc145>xbmc.activatewindow(music)</obc145>
        <obc146>xbmc.activatewindow(video)</obc146>
        <obc147>FullScreen</obc147>
        <obc148>XBMC.ActivateWindow(favourites)</obc148>
        <obc149>ToggleWatched</obc149>
        <obc150>DecreaseRating</obc150>
        <obc151>IncreaseRating</obc151>
    </universalremote>
  </global>
 
  <fullscreenvideo>
    <universalremote>
        <obc135>XBMC.ActivateWindow(videoosd)</obc135>
        <obc138>CodecInfo</obc138>
        <obc111>AspectRatio</obc111>
        <obc116>FullScreen</obc116>
        <obc139>FullScreen</obc139>
        <obc144>NextSubtitle</obc144>
        <obc137>ShowTime</obc137>
        <obc145>AudioNextLanguage</obc145>
        <obc146>XBMC.ActivateWindow(OSDVideoSettings)</obc146>
        <obc151>XBMC.ActivateWindow(VideoBookmarks)</obc151>
        <obc112>BigStepForward</obc112>
        <obc113>StepForward</obc113>
        <obc114>BigStepBack</obc114>
        <obc115>StepBack</obc115>
    </universalremote>
  </fullscreenvideo>
 
  <visualisation>
    <universalremote>
        <obc135>XBMC.ActivateWindow(musicosd)</obc135>
        <obc138>CodecInfo</obc138>
        <obc139>FullScreen</obc139>
        <obc116>FullScreen</obc116>
        <obc137>Info</obc137>
        <obc145>XBMC.ActivateWindow(OSDAudioSettings)</obc145>
        <obc146>XBMC.ActivateWindow(visualisationsettings)</obc146>
        <obc144>XBMC.ActivateWindow(visualisationpresetlist)</obc144>
    </universalremote>
  </visualisation>
 
  <videoosd>
    <universalremote>
        <obc135>PreviousMenu</obc135>
        <obc137>ShowTime</obc137>
        <obc144>ShowSubtitles</obc144>
        <obc145>XBMC.ActivateWindow(OSDAudioSettings)</obc145>
        <obc146>XBMC.ActivateWindow(OSDVideoSettings)</obc146>
        <obc151>XBMC.ActivateWindow(VideoBookmarks)</obc151>
    </universalremote>
  </videoosd>
 
  <musicosd>
    <universalremote>
        <obc135>PreviousMenu</obc135>
        <obc137>Info</obc137>
        <obc145>XBMC.ActivateWindow(OSDAudioSettings)</obc145>
        <obc146>XBMC.ActivateWindow(visualisationsettings)</obc146>
        <obc144>XBMC.ActivateWindow(visualisationpresetlist)</obc144>
    </universalremote>
  </musicosd>
 
  <OSDVideoSettings>
    <universalremote>
        <obc137>PreviousMenu</obc137>
        <obc144>PreviousMenu</obc144>
        <obc145>PreviousMenu</obc145>
        <obc146>PreviousMenu</obc146>
    </universalremote>
  </OSDVideoSettings>
 
  <VideoBookmarks>
    <universalremote>
        <obc137>PreviousMenu</obc137>
        <obc144>PreviousMenu</obc144>
        <obc145>PreviousMenu</obc145>
        <obc146>PreviousMenu</obc146>
        <obc151>PreviousMenu</obc151>
    </universalremote>
  </VideoBookmarks>
 
  <OSDAudioSettings>
    <universalremote>
        <obc137>PreviousMenu</obc137>
        <obc144>PreviousMenu</obc144>
        <obc145>PreviousMenu</obc145>
        <obc146>PreviousMenu</obc146>
    </universalremote>
  </OSDAudioSettings>
 
  <visualisationsettings>
    <universalremote>
        <obc137>PreviousMenu</obc137>
        <obc144>PreviousMenu</obc144>
        <obc145>PreviousMenu</obc145>
        <obc146>PreviousMenu</obc146>
    </universalremote>
  </visualisationsettings>
 
  <visualisationpresetlist>
    <universalremote>
        <obc137>PreviousMenu</obc137>
        <obc144>PreviousMenu</obc144>
        <obc145>PreviousMenu</obc145>
        <obc146>PreviousMenu</obc146>
    </universalremote>
  </visualisationpresetlist>
 
  <favourites>
    <universalremote>
        <obc137>PreviousMenu</obc137>
        <obc144>PreviousMenu</obc144>
        <obc145>PreviousMenu</obc145>
        <obc146>PreviousMenu</obc146>
        <obc148>PreviousMenu</obc148>
    </universalremote>
  </favourites>
 
  <videolibrary>
    <universalremote>
        <obc139>ParentDir</obc139>
        <obc138>ReplaceWindow(videofiles)</obc138>
    </universalremote>
  </videolibrary>
 
  <videofiles>
    <universalremote>
        <obc139>ParentDir</obc139>
        <obc138>ReplaceWindow(videolibrary)</obc138>
    </universalremote>
  </videofiles>
 
  <musiclibrary>
    <universalremote>
        <obc139>ParentDir</obc139>
        <obc138>ReplaceWindow(musicfiles)</obc138>
        <!--
        <obc102>FilterSMS2</obc102>
        <obc103>FilterSMS3</obc103>
        <obc104>FilterSMS4</obc104>
        <obc105>FilterSMS5</obc105>
        <obc106>FilterSMS6</obc106>
        <obc107>FilterSMS7</obc107>
        <obc108>FilterSMS8</obc108>
        <obc109>FilterSMS9</obc109>
        -->
    </universalremote>
  </musiclibrary>
 
  <musicfiles>
    <universalremote>
        <obc139>ParentDir</obc139>
        <obc138>ReplaceWindow(musiclibrary)</obc138>
        <!-- <obc102>FilterSMS2</obc102>
        <obc103>FilterSMS3</obc103>
        <obc104>FilterSMS4</obc104>
        <obc105>FilterSMS5</obc105>
        <obc106>FilterSMS6</obc106>
        <obc107>FilterSMS7</obc107>
        <obc108>FilterSMS8</obc108>
        <obc109>FilterSMS9</obc109>
        -->
    </universalremote>
  </musicfiles>
 
  <fullscreeninfo>
    <universalremote>
        <obc125>PreviousMenu</obc125>
        <obc137>PreviousMenu</obc137>
    </universalremote>
  </fullscreeninfo>
 
  <filemanager>
    <universalremote>
        <obc139>ParentDir</obc139>
        <!-- <obc102>FilterSMS2</obc102>
        <obc103>FilterSMS3</obc103>
        <obc104>FilterSMS4</obc104>
        <obc105>FilterSMS5</obc105>
        <obc106>FilterSMS6</obc106>
        <obc107>FilterSMS7</obc107>
        <obc108>FilterSMS8</obc108>
        <obc109>FilterSMS9</obc109>
        -->
    </universalremote>
  </filemanager>
 
  <pictures>
    <universalremote>
        <obc139>ParentDir</obc139>
    </universalremote>
  </pictures>
 
  <slideshow>
    <universalremote>
        <obc101>ZoomLevel1</obc101>
        <obc102>ZoomLevel2</obc102>
        <obc103>ZoomLevel3</obc103>
        <obc104>ZoomLevel4</obc104>
        <obc105>ZoomLevel5</obc105>
        <obc106>ZoomLevel6</obc106>
        <obc107>ZoomLevel7</obc107>
        <obc108>ZoomLevel8</obc108>
        <obc109>ZoomLevel9</obc109>
        <obc110>ZoomNormal</obc110>
    </universalremote>
  </slideshow>
 
  <virtualkeyboard>
      <universalremote>
        <obc139>BackSpace</obc139>
    </universalremote>
  </virtualkeyboard>
 
  <shutdownmenu>
    <universalremote>
        <obc119>PreviousMenu</obc119>
    </universalremote>
  </shutdownmenu>
 
  <home>
    <universalremote>
        <obc116>FullScreen</obc116>
        <obc139>FullScreen</obc139>
    </universalremote>
  </home>
 
</keymap>

And the battery_change.sh script:

#!/bin/sh
echo "Current battery level is: $2" > /home/yourusername/battery_level.txt

Happy XBMC-ing! 🙂

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="movie.srt" --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.