Category Archives: Audio/Video

Remove All Save One Subtitle Stream from Video

This can be done using ffmpeg.

ffmpeg -y -i 01\ –\ Chapter\ 1\:\ \ Le\ Collier\ de\ la\ reine.mkv -map 0:v -map 0:a? -map 0:s:5 -codec copy 01\ –\ Chapter\ 1\:\ \ Le\ Collier\ de\ la\ reine_.mkv

Take a look at the (third) -map 0:s:5. That bit tells ffmpeg which stream to keep. I got mine from just counting down the list of subtitles under the Subtitles menu in VLC. Remember that the first element is 0.

(This can also be used to remove audio streams by changing the s to an a in that same bit.)

Also, note that in my output file I added an underscore to the end of the file name: Don’t overwrite your original (you may not get it right the first go).

(See this source here.)

Share

Convert ISO into MKV

First you want to either mount or unpack your ISO so you can work with the containing files directly.  Those are easy to do via the GUI using the mouse and its right-click menu.  I recommend unpacking.  Start that and walk away.  It will take some time to pack the entire disc image.

Once unpacked open your terminal and cd into the VIDEO_TS directory of your freshly unpacked files.  In there you will find some number of VOB files named like VTS_01_1.VOB.  The first of those (_0) is likely a menu item.  You can confirm this by playing it in VLC.  Once confirmed rename it from .VOB to _VOB to hide it from the next command.  The remaining (_1 through _?) should be the actual video content.  Again, confirm this using VLC.

Basically, the VOB files for actual content will be the same size except the last one which is smaller than the others.  If there are any other VOB files not part of your target content rename those also as _VOB.

Now we can merge those all together into a single file:  cat *.VOB > output.vob

(And now it’s obvious why we were hiding any superfluous .VOB files.)

Finally, use ffmpeg to go from .vob to .mkv:  ffmpeg -i output.vob  -c:v libx264 -c:a aac output.mkv

That’s the quick and dirty version which has worked for me.  You will notice it also shrinks the file size.  There is a ton of information about using ffmpeg out there so if you require different conversions, someone out there can probably guide your specific quest.

Share

High Bitrate ISO Music to FLAC

Here is the process I used to convert some DVD-audio ISO files into proper FLAC files for inclusion in my main collection.  No compromise in channels nor in audio quality required.

These instructions are for Ubuntu but will likely work on most Linux distributions (since ffmpeg and flac are so common).  Mac?  Maybe.  Win10 with bash?  Probably.

The basics are as follows:

  • mount the ISO (or extract the relevant files)
  • use ffmpeg to extract audio data into wav files
  • stitch multiple wav files together using Audacity or ffmpeg
  • split that full-album wav into individual songs
  • convert those wav songs into FLAC files
  • tag and move into the main collection

Often mounting an ISO is a matter of right-clicking and choosing Mount; regardless I leave it up to you to make that happen in whatever manner you choose.  All that matters is that we can access the files through a specific file path. (Alternatively you can extract the relevant files to an accessible file path for the subsequent commands.)

You will need to fun ffmpeg against each audio file from the mounted ISO in order to get a complete collection of wav files to conjoin.  My most recent ISO had two and this command is for the second extraction:

##
ffmpeg -i ~/Desktop/ISO/AUDIO_TS/ATS_01_2.AOB ~/Desktop/RW/02_end.wav 

# run ^^this^^ line for each file containing audio and with a unique file name (in order) 

# you can use the following line to stitch two (or more by modification) wav files into a single long file 

ffmpeg -i ./01_start.wav -i ./02_end.wav -filter_complex '[0:0][1:0]concat=2:v=0:a=1[out]' -map '[out]' full.wav 

# you can see above you'd need to add more -i (input) files and you'd want to alter the bit before and the bit after concat to correspond with the correct number of files 
##

Either use the above command to stitch all files together or open all your files in Audacity (or whatever you’d like) and paste each track against the end of the previous track until you have one project containing the entire audio content.  Export that as a single wav file.

Audacity will default to exporting as a two-channel 16×44 wav file.   You can change the bitrate in the lower-left of the project window.  For multi-channel exports, you’ll need to navigate to Edit → Preferences → Import/Export → When exporting tracks to an audio file → Use custom mix (radio button).  Now you are set to wave the full wave file.

Next you get to struggle with dividing the full file into individual songs.  This can be made all the more challenging if your album is progressive rock.  Who needs gaps between so-called songs?  Anyway, I can not offer much advice though there is this handy page from Audacity that could help.

You can do it!

Converting into FLAC is really easy.  It’s probably the easiest step in the whole process.  (Splitting into individual songs is probably the least easy if you’re keeping track.)

##
# cd into the folder where your newly created wav files are located and run flac itself 

flac --best --channel-map=none -V *.wav 

# you only need --channel-map=none if your full-length file has more than two tracks  
##

Once that has finished, you can tag your music.  I use EasyTag because it’s easy.

Share

Rotate Android Videos in Ubuntu

It seems that if I don’t have my phone angled just so, it will invisibly rotate my video.  The rotation at the beginning of the film is what is used throughout, so if you think you have it horizontal and it turns out your first frame was vertical the entire film is then vertical.  And you won’t realize this until you attempt playback.

There are probably a million and one ways to fix the video rotation.  Unfortunately none of those are built into the phone.  I downloaded the video onto my laptop (running Ubuntu 16.04).

Most of the advice I found was to use a program called Avidemux.  I have used it in the past to change audio or video codices or move a video into a different container/wrapper (to mkv for example), and I have found it useful enough.  However, it would appear that Avidemux is no longer present in the usual Ubuntu repositories as both apt and the Ubuntu Software Center did not find it.

I poked around and found a pretty simple command line rotation solution using ffmpeg here.  I tried the version of the command in the response, but encountered an error:

[aac @ 0x6cf380] The encoder ‘aac’ is experimental but experimental codecs are not enabled, add ‘-strict -2’ if you want to use it.

Since my phone uses aac (apparently) I needed to add the -strict -2 in order to enable an experimental encoder.  So metal!

ffmpeg -i Desktop/VID_20161008_144216.mp4 -vf “transpose=2” -strict -2 Desktop/VID_20161008_144216_rotatecc.mp4

It worked great.  The response offers some other rotation options, but of course the man page for ffmpeg is extensive.

Share

ALAC Freed at Last (Not That It’ll Matter Much)

If you are an Apple user there is a very slim chance you have used ALAC files on your various components.

ALAC or Apple Lossless Audio Codec is a lossless audio codec (duh).  It compresses music down from their original size on a CD to about half of that size without any change in audio fidelity (the two files are mathematically equivalant); compare this to the mp3 (or ogg or aac or …) where the two files, though very different in size, are not the same sonically speaking (the conversion equation leaves a remainder which is thrown out and thus lost).  Audiosnobsphiles (myself included) seek out lossless compression formats over lost (or lossy) formats in pursuit of sound qualities nearer to the original master recordings.  Suffice it to say, it’s a niche market.

Apple developed their own lossless codec back in 2004 (or at least introduced it then).  FLAC (the Free Lossless Audio Codec) was introduced just a few years before in 2001, so perhaps this was part of Apple’s motivation.  In terms of math and in terms of sound there is no fundamental reason to select one of these two codecs over the other: they will sound identical if from the same source and can be interconverted indefinitely with no change to the music there contained.

Until recently, however, only one of these was freely available and open to the public (open source).  Just a few days ago Apple released the source code for ALAC under the Apache license.  (FLAC has open under the GNU GPL since it’s introduction.)  (This is about the best article currently available on the Apple announcement.)

For those of us who use software which is not owned by Apple we have still been able to play ALAC files (or convert them to FLAC) since about March of 2005 (thanks to two clever C programmers—read about that here).  (I wrote an article on converting ALAC and other formats to FLAC on Ubuntu.)

I have no ALAC currently in my collection.  Since ALAC was held by Apple and only functional on Apple software and devices by default it would have made a poor choice for my larger music collection since it has always been my intention to use that music on all of my devices.  I even went so far as to install Rockbox on my iPod Classic so that I could enjoy my FLAC files on that device.

I just don’t see this open-sourcing of ALAC as likely to effect many folks.  It may have some minor impact on the larger acceptance of FLAC if Apple continues to dis-support FLAC on their operating systems, software, and devices.  Then again this could well be a sign that Apple will finally begin supporting (or at least no longer actively dis-supporting) FLAC.  (Dream with me.)

The only thing I really dislike about ALAC is the lack of conformity and sense in the file extension.  Typically Apple uses the m4a extension.  This is because they put the file within the mp4 wrapper.  Unfortunately m4a is not an accepted file extension under the mp4 specifications.  It’s also possible that you will find an AAC file (remember that’s the extension they use for their lost compression format).   Keep in mind there is no programmatic relationship between AAC and ALAC; this is a bad practice and is to be avoided.

I suppose they could use either ALE or ALAC but I don’t think I’ve ever seen them.  So, yes, typically they use the unspecified (We made it up!) file extension mp4, and that wouldn’t be all that bad except that mp4 is a wrapper and you can put anything you’d like in it; like an AAC.  So really it’s anybody’s guess if you have a lossless or a lost file.

Of course this isn’t a criticism of the specification but rather merely a criticism of the deployment thereof.

Anyway, that’s the news.  Probably you won’t care.  If they have some clever political agenda for this maneuver it’s beyond me at present.  We shall see what the future holds.

Share

Burning in Banshee

I wanted to burn one of my playlists to a CD this morning, but I had some trouble figuring out how or where Banshee managed the burning.

I thought perhaps I could just locate a playlist and right-click on that playlist and choose Burn to CD or something equally obvious. Nope.

Right-clicking on a playlist in Banshee gives three options:

Rename
Export Playlist…
Delete Playlist…

I then thought maybe there would be an export option that was something like … as CD or maybe even … as ISO. No luck. Just three different playlist file options (m3u, pls, and xspf). I really didn’t want to have to export the playlist and use another application to burn from that file manually.

After some thrashing about and some mild cursing I found that if you right-click on any track (in a playlist or otherwise) you will find a related option:

Write CD…

Of course that will open Brasero with the one track ready to burn. Ok. That was enough for understanding but let’s agree that’s a little silly.

Here is the short version for those who are still scratching their heads. First you enter one of your playlists (by clicking on it). Then you select all of the tracks in that playlist. Finally you right-click on those selected tracks and send those to Brasero using the Write CD… option.

Have fun with that.

Share

Banshee, Its Library, and Importing Playlists

I have been preparing myself for the move from Rhythmbox to Banshee as the default media library application in future versions of Ubuntu.  I have encountered some interesting peculiarities and I thought I’d talk a bit about them here for your benefit.

One significant change from Rhythmbox to Banshee is the way playlists and the library itself are managed.  Rhythmbox, bless its little heart, uses a simple XML file for the library and another for all the playlists combined.  Banshee by contrast makes use of SQLite to house all this information.

XML is particularly easy to manipulate using a basic text editor.  I’m no database administrator, so it will take me some time to get up to speed in making the SQL queries and changes I might want to make.  There is one functionality I was able to work through, however, and that is migrating playlists.

(In the end I abandoned importing my playlists and am looking into alternative solutions.  Reason is Banshee eventually either emptied every playlist (what?) or shifted the playlist contents to a neighboring playlist (double-what?) so that I couldn’t trust Banshee to store a playlist in any useful way.)

In order to move playlists from Rhythmbox to Banshee I first exported the playlists individually (I exported them as .pls files).  That was simple enough.  Here is a quirk though.  Rhythmbox marks the file paths for playlists in the format [library root]/path/to/file.flac.  In my case, since the library was located in ~/Music and since Music contained a link to my server share with all the music the path looked something like this:

Music/[share]/path/to/file.flac

Banshee, using the same setup and for reasons I have yet to determine, decided that all of the file locations were not at ~/Music/[share]/ but instead were located at /media/[share]/ (the mount point to which the shortcut in Music was aimed).

If I imported the playlist(s) as exported Banshee would get all confused about file locations and paths and I would end up with a bunch of duplicate entries where one used the ~/Music designation and the other used the /media designation.  It was rampant and bizarre and spilled beyond the borders of the imported playlists to files never mentioned in any playlist (though it did not infect the entire library).  Very odd; very frustrating.

It did not end there though.  The playlists would eventually empty.  All of the tracks listed in the playlist would, over some seemingly random period or through some as yet undetermined set of events, become devoid of tracks until each playlist would contain zero tracks.  The files were still in the collection; however, the mis-pathed files or duplicate files would be purged from the library.

I finally manipulated the playlist files (the .pls files) themselves using GEdit.  (Any text editor with a find and replace feature will do nicely.)  I changed every occurrence of Music/ to /media/ and this made all the difference.  The path duplication problem was gone since all the file paths were pointing to the /media/ location. I am confident this fixes this issue.

I have no idea why Banshee parses the link into its destination path (parses the relative path into an absolute path?).  I can’t think of another case where an application changes /path/to/link/ into /destination/of/link all on its own.  This may be expected behavior for Banshee (and by all measures seems to be), but I don’t understand it at present.

At any rate, this article ought to help anyone trying to migrate from Rhythmbox to Banshee at least get their playlists migrated over, and it ought to help understand some unique behavior in this new default media application.

I suppose I should take a moment to mention why Rhythmbox saves playlists with Music/ as the path root.  It seems that when you save a playlist Rhythmbox changes the file paths from what is used in the playlist.xml file which stores all playlist data (in my case: file:///home/[username]/Music/[share]/…) into a home-directory relative path (in my case: Music/[share]/…).  My guess is this is done to make the playlist available to anyone in a similar situation as the user who created the playlist (.pls) file—that user would run the .pls file from their own home directory and all would be well enough.

Again, you may or may not find this useful.  For my part I know I’d rather not have to rediscover it.

Oh there is one more important thing about importing playlists I should mention.  When you import the playlist it will be ordered by something-of-which-I-remain-uncertain.  It’s probably ordered by a field I don’t view.  Anyway, to get the playlist to sort by the playlist order (that is to say the order you created for that playlist) thrice click on any of the view column headers to first sort by that view, then reverse sort by that view, then finally to turn off view-by-column sorting for the playlist.

I created some related posts on the Ubuntu forums (here and here) as I was working through these matters.

Let me know if you have anything to add.

Happy hunting.

Share

A New Script for Skipping Tracks

A while back I wrote a simple script for skipping tracks (and a couple of other things) for Rhythmbox.  Now that Ubuntu is moving to Banshee as their default media library application I have tossed together a new script for use with Banshee.

The trouble with Rhythmbox was getting the system to understand, when attached remotely, which monitor contained Rhythmbox.  This was dealt with by making use of the $DISPLAY variable.  Banshee makes this problem a bit more difficult.  Banshee uses dbus and dbus is more difficult to guess at and more difficult to inquire.  A little research has given me a workable bit of code that gets me there.  (I am still researching this code either for better or safer or more elegant solutions.)

I have built in some logic to make the script handle situations where the user inputs a command (argument) that is not necessarily appropriate to the current state of Banshee. It should handle most of what you might (accidentally?) throw at it. I still want to give it some parsing abilities so that when it displays the currently playing information it’s more user friendly. I’ll just add that here when I get that built.

I have built a code section (in two parts) for seeking (forward and reverse). The problem is that in my version of Ubuntu there is a dependency bug (in dbus) so the seeking won’t work for Banshee from the command line. I have included it here for folks for whom this bug does not apply. Feel free to comment on your operating system and Banshee version if my code works for you.

To get the seek code working simply paste the two parts into the two places in the script where I have placed markers. (You may optionally uncomment (remove the #’s) from the two lines in the help section near the end of the script, but it’s not required for the seek code to function. If you are running Ubuntu 10.04 like me you won’t need the seek code unless you have dealt with the dbus bug yourself.)

##
#!/bin/bash
# Banshee Control Script
# by JamesIsIn from JamesIsIn.com
# Do something nice today.

# First tell the system how to find the current running version of Banshee if you are running this script remotely.  If you only use the script locally you can comment out this export line.
# This command reports a host of permissions errors and doesn't need to display its output to the user so we divert STDERR to null.

export $(strings /proc/*/environ 2> /dev/null | grep DBUS_SESSION | tail -1)


# Now we can manipulate Banshee.
# Grab that variable...

argument=$1

## The first part of the seek code belongs here.



##



# ... and shake it!

   if [ "$argument" = "p" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
         if [ "$pbstat" = "paused" ]; then
            printme="I am resuming playback."
            banshact="banshee --play"
            banshow="banshee --query-title --query-artist --query-track-number --query-track-count --query-album --query-disc --query-year --query-duration"
         elif [ "$pbstat" = "idle" ]; then
            printme="I am beginning playback."
            banshact="banshee --play"
            banshow="banshee --query-title --query-artist --query-track-number --query-track-count --query-album --query-disc --query-year --query-duration"
         elif [ "$pbstat" = "playing" ]; then
            printme="I am pausing playback."
            banshact="banshee --pause"
         else
            printme="Is Banshee even on?  I'm confused." 
         fi

   elif [ "$argument" = "play" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
      if [ "$pbstat" = "idle" ]; then
         printme="I am beginning playback."
         banshact="banshee --play"
         banshow="banshee --query-title --query-artist --query-track-number --query-track-count --query-album --query-disc --query-year --query-duration"
      elif [ "$pbstat" = "paused" ]; then
         printme="I am resuming playback."
         banshact="banshee --play"
         banshow="banshee --query-title --query-artist --query-track-number --query-track-count --query-album --query-disc --query-year --query-duration"
      elif [ "$pbstat" = "playing" ]; then
         printme="Banshee is already playing."
      else
         printme="Is Banshee even on?  I'm confused."
      fi

   elif [ "$argument" = "pause" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
      if [ "$pbstat" = "playing" ]; then
         printme="I am pausing playback."
         banshact="banshee --pause"
      elif [ "$pbstat" = "paused" ]; then
         printme="Banshee is paused.  Use p or play to resume playback."
      elif [ "$pbstat" = "idle" ]; then
         printme="Banshee is stopped.  Use play to resume playback."
      else
         printme="Is Banshee even on?  I'm confused."
      fi

   elif [ "$argument" = "stop" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
      if [ "$pbstat" = "playing" ]; then
         printme="I am stopping playback."
         banshact="banshee --stop"
         
      elif [ "$pbstat" = "paused" ]; then
         printme="Banshee was paused and I have now stopped it."
         banshact="banshee --stop"
         
      elif [ "$pbstat" = "idle" ]; then
         printme="Banshee is already stopped."
      else
         printme="Is Banshee even on?  I'm confused."
      fi

   elif [ "$argument" = "n" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
      if [ "$pbstat" = "playing" ]; then
         printme="I am skipping to the next track."
         banshact="banshee --next"
         banshow="banshee --query-title --query-artist --query-track-number --query-track-count --query-album --query-disc --query-year --query-duration"
      elif [ "$pbstat" = "paused" ]; then
         printme="Banshee is paused.  Use p or play to resume playback."
      elif [ "$pbstat" = "idle" ]; then
         printme="Banshee is stopped.  Use play to resume playback."
      else
         printme="Is Banshee even on?  I'm confused."
      fi
   

   elif [ "$argument" = "r" ]; then
      printme="I am going to rewind now.  Doing this early enough will supposedly go to the previous track."
      banshact="banshee --previous"
      banshow="banshee --query-title --query-artist --query-track-number --query-track-count --query-album --query-disc --query-year --query-duration"
      
# I should be able to prettify this and account for null variables.
# what I want: You are listeing to song by so-and-so (x of y) from album [] [year] ti:me.

   elif [ "$argument" = "s" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
      if [ "$pbstat" = "playing" ]; then
         printme="This is what is currently playing:"
         banshow="banshee --query-title --query-artist --query-track-number --query-track-count --query-album --query-disc --query-year --query-duration"
      elif [ "$pbstat" = "paused" ]; then
         printme="Banshee is currently paused here:"
         banshow="banshee --query-title --query-artist --query-track-number --query-track-count --query-album --query-disc --query-year --query-duration"
      elif [ "$pbstat" = "idle" ]; then
         printme="Banshee is currently stopped.  Use play to resume playback."
      else
         printme="Is Banshee even on?  I'm confused."
      fi

## The second part of the seek code belongs here.



##

   elif [ "$argument" = "c" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
      printme="Banshee is currently $pbstat."

   else
      printf "\nI'm sorry.  I only understand the following arguments:\n\n"
      printf "  p     -- attempt to toggle between play and pause\n"
      printf "  r     -- rewind to beginning or skip reverse\n"
      printf "  n     -- skip to next track\n"
      printf "  s     -- show what's playing\n"
      printf "  play  -- play\n"
      printf "  pause -- pause\n"
      printf "  stop  -- stop\n"
      printf "  c     -- display the current state of Banshee\n\n"
# You may want to uncomment the next two lines if you are using the seek code.
#      printf "  ff    -- fast forward (include seconds as ff 10)"
#      printf "  rr    -- rewind (include seconds as rr 5)"
      printf "Note that the arguments do not use a hyphen.  Please try again.\n\n"
      exit
   fi


$banshact
echo
echo $printme
echo
$banshow
echo


exit

##

As you can see, I have given play/pause toggling (where banshee itself doesn’t really have it) through the clever use of an if-loop (I’ll just pat myself on the back, ok?). Also it tells you what is playing anytime you start playing something (new or resumed).

Point of interest, there is bit of code that was not working in the script:

banshee –play; banshee –query-title –query-artist –query-track-number –query-track-count –query-album –query-disc –query-year –query-duration

Thing is if you paste this into a terminal it works perfectly. The problem is that semi-colon. On the command line it’s just fine, but in the script there must be a space after the --play or the shell will interpret the argument as literally --play; and it won’t work.

So the basic usage of the script is in this format:

Bs p

I placed this script in /usr/local/bin on the hi-fi machine. I called it merely Bs. That way the script is available to all users on that machine and is easy to call up from the terminal.

Be sure to make the file executable:

sudo chmod a+x /usr/local/bin/Bs

For those who would like to add the seek functionality, here it is. You can always test it on your system to see if it works and remove it (or comment it out) if it doesn’t.

##
#!/bin/bash
# Seek functionality for Banshee Control Script
# by JamesIsIn from JamesIsIn.com
# Do something nice today.

## This is the first part of the seek code.

seekseconds=$2
roundseek=$( printf "%0.f\n" $seekseconds )

##


## This is the second part of the seek code.

   elif [ "$argument" = "ff" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
         if [[ $roundseek =~ ^[0-9]+$ ]]; then
            currentlocation=`banshee --query-position`
            currloc=${currentlocation#* }
            roundloc=$( printf "%0.f\n" $currloc )
            seekchange=$(( roundloc + roundseek ))
               if [ "$pbstat" = "playing" ]; then
                  printme="I am advancing playback by $roundseek seconds."
                  banshact="banshee --set-position=$seekchange"
                  banshow=""
               elif [ "$pbstat" = "paused" ]; then
                  printme="Banshee is paused but I have advanced the pause location by $roundseek seconds."
                  banshact="banshee --set-position=$seekchange"
                  banshow=""
               elif [ "$pbstat" = "idle" ]; then
                  printme="Banshee is neither playing nor paused and thus I am not able to advance anything"
                  banshact=""
                  banshow=""
               else
                  printme="Is Banshee even on?  I'm confused."
                  banshact=""
                  banshow=""
               fi
         else
            printme="When using ff you must enter seconds in the format \"Bs ff 5\" in order for me to process your request."
            banshact=""
            banshow=""
         fi   
      
   elif [ "$argument" = "rr" ]; then
      playbackstatus=`banshee --query-current-state`
      pbstat=${playbackstatus#* }
         if [[ $roundseek =~ ^[0-9]+$ ]]; then
            currentlocation=`banshee --query-position`
            currloc=${currentlocation#* }
            roundloc=$( printf "%0.f\n" $currloc )
            seekchange=$(( roundloc - roundseek ))
               if [ "$pbstat" = "playing" ]; then
                  printme="I am rewinding playback by $roundseek seconds."
                  banshact="banshee --set-position=$seekchange"
                  banshow=""
               elif [ "$pbstat" = "paused" ]; then
                  printme="Banshee is paused but I have rewound the pause location by $roundseek seconds."
                  banshact="banshee --set-position=$seekchange"
                  banshow=""
               elif [ "$pbstat" = "idle" ]; then
                  printme="Banshee is neither playing nor paused and thus I am not able to rewind anything"
                  banshact=""
                  banshow=""
               else
                  printme="Is Banshee even on?  I'm confused."
                  banshact=""
                  banshow=""
               fi
         else
            printme="When using rr you must enter whole-numbered seconds in the format \"Bs rr 5\" in order for me to process your request."
            banshact=""
            banshow=""
         fi



##

Have fun with this one too. Suggestions are welcome.

Share

OGG Will Ninja Your MP3 and Make You Happy

I’d prefer that everyone in the world used FLAC, but since there is still an inexplicable desire to use lost compression formats to save storage space I am going to recommend that you at least upgrade to the OGG Vorbis format.

PlayOgg

This lost format uses a better compression algorithm than does MP3 (or AAC or WMA &c).   This means that for a comparable bit rate you will get a better sounding reproduction and likely a slightly smaller file.

No, iTunes does not natively support either FLAC or Ogg.  However, nearly every other media player out there does (from VLC to Windows Media Player with a plugin to Winamp).  If you are using a Mac iTunes can be made to play nicely with FLAC and Ogg (see this post for information about this lamentable exclusion on the part of Apple and a workaround for Mac users), but again I would recommend using some of the other players (a nice list is found on the workaround article I linked above).

Seriously though, buy some decent storage and use FLAC.  It’s lossless so you are not making a compromise as you are with each of the lost formats.

Don’t cry to me because you can’t fit six months worth of music on your personal music player.   We used to be content carrying around three or four tapes at a time (while walking up hill both ways in the snow).  Even a small player (say 8 GB) will hold more than that (8 GB could hold about 20 albums as FLAC).

I have a 60 GB iPod (running RockBox so I can play FLAC’s; kiss my ass, Apple) and there is enough music on there (though less than 10% of my collection) that I don’t see repeated tracks after months of casual listening on the bus.

If you don’t feel up to making the switch to lossless audio and want to stick with lost formats, OGG will still provide better performance than an MP3.

Be good to your ears.  They love you long time.

Share

Script for Skipping Tracks

I use Rhythmbox to play music on my hi-fi system.  There is a command line element for Rhythmbox called rhythmbox-client.  This element can be used to initiate a series of commands in Rhythmbox.  The problem is that these commands end up being a bit longish if you are attached to that machine via ssh.  Here is an example:

DISPLAY=:0.0 rhythmbox-client –play-pause

That’s a lot of typing especially when you are attached via ssh from your Android phone.  It was just too tedious to type all that out on that on-screen keyboard.  So I wrote a script that would manage the arguments I felt were most important.

##
#!/bin/bash
# by JamesIsIn from JamesIsIn.com
# Do something nice today.


   if [ "$1" = "n" ]; then
      argument="--next --print-playing"
      printf "\nI am skipping to the next track:\n\n"
   elif [ "$1" = "p" ]; then
      argument="--play-pause"
      printf "\nI am toggling between play and pause.\n\n"
   elif [ "$1" = "s" ]; then
      argument="--print-playing"
      printf "\nThis is what is currently playing:\n\n"
#   if [ "$1" = "q" ]; then
#      $argument="--enqueue"
   else [ argument = "" ]; 
      printf "\nI'm sorry.  I only understand the following commands:\n\n"
      printf "p (play/pause)\n\n"
      printf "s (show what's playing)\n\n"
      printf "n (skip to next track)\n\n"
      printf "Please try again.\n\n"
      exit
      # I could add --enqueue but I have to figure out to make it work
   fi


# assuming DISPLAY does not matter for local runs (though this is for a single monitor configuration)

DISPLAY=:0.0 rhythmbox-client $argument
echo


exit

##

The use of DISPLAY is required so that rhythmbox-client knows on which monitor Rhythmbox is present.  The configuration above is for a single monitor arrangement.  You’re on your own to figure out what you need in there if you have a different monitor configuration.

So, using my script, if you wanted to issue the same command I mentioned above you would merely type:

Rb p

(Now I just need to streamline the ssh command and this whole procedure will be much easier and thereby more impressive.)

I placed this script in /usr/local/bin on the hi-fi machine. I called it merely Rb. That way the script is available to all users on that machine. Be sure to make the file executable:

sudo chmod a+x /usr/local/bin/Rb

(Since I use my server as a proper server now I moved my script to the share: /media/[share]/Rb so that it would be available across the network.)

Have fun with that.

Share