Archive for the ‘Multimedia’ Category

problems and solutions

Tuesday, November 4th, 2008

I had a lot of time on my hands yesterday, from getting home from my vacation as well as being sick (I should be in bed right now), so I did a lot of playing around with encoding my videos again. I’ll write more about that later, but one thing that has has proved interesting while finding another possible standard to apply for my library, is how there are a few things I was so adamant about having in the beginning that don’t really matter at all after some practical application.

I can only think of a couple of examples off the top of my head, but it’s funny to see how stuff I just whined and cranked about being a “must have” back in the day, after many hours of actually accessing my library, my assumptions on what I “needed” were wrong.

Perhaps the most important realization I made, though, was that different categories require completely different approaches. When it comes to a multimedia library, you can’t apply the same standard to a movie and to a TV episode. I’m still mulling over in my head if that’s true with live-action and animated shows.

Video metadata: titles and chapters

Way back when, I was adamant about getting chapter information in my metadata, so I could quickly jump to points where I needed to in my videos. This actually makes sense for movies, where there will be something like a dozen or more chapters that jump between obvious scenes, but for TV shows, it doesn’t make so much sense, where there might be four or more on an hour long show, and usually nothing on a half-hour show.

But, setting chapters was probably one of the main reasons for me choosing Matroska in the first place over all the other container formats, simply because it was the only one (aside from OGM) that supported it. OGM was nice, though, but I vaguely recall that there were reasons for not using it. I can’t really think of any right now, but I imagine that since development has stopped, and mkvmerge had more options and supported more codecs and is actively developed, that probably made the choice simple.

The reality is that I never use the chapters. The solution that eventually worked it’s way into the scene was just fixing mplayer-resume to work correctly. Add to that the fact that I can resume playback from a series of a TV show (a playlist of media files), and I’m happy to be able to pick up anytime where I left off, versus flicking back and forth between chapters to find it myself. The problem I worked so hard to avoid never came up. Interesting.

Subtitles

One problem I struggled with a long time was that I wanted to have subtitles, mostly “in case I ever want them.”

I went to a lot of work figuring out how to get VobSub formatted subtitles out of a DVD and into a Matroska file. That, in itself, was rewarding. For one, I needed to learn how to find one possible solution, and this one proved very simple.

The reality, again, though, is that I never use them and in fact they are more annoying than helpful. Only annoying because MPlayer is forcing them to be on, when I don’t want them to, which is a bug, but still.

The “problem” in this case is still there, and I think that as far as long-term solutions and archiving goes, it’s a good idea to keep them, but it’s again telling that I had another must-have feature which never got used.

Audio quality

This is one I’m currently dealing with fixing, since I’m looking at other containers aside from Matroska. Part of me hates to let go of my vehement fanboyism, but a large part of me knows that it’s good to be objective, even if the software isn’t up to speed just yet. Does Matroska have the best support on Linux *right now* to do everything I need to? Absolutely. Should I use it for everything, everywhere, all the time? Not really. I’m going off on a tangent again, though.

I’ve always maintained that the audio quality should remain in the original AC3 (Dolby Digital) format, simply because I might someday (another archival/possibility requirement) want to someday pipe all the audio through my receiver.

Again, the reality completely disagrees with the presumed history. Turning on my receiver, switching my audio devices around, and using the remote to control two different volumes is a real hassle. I never do it. Also, this is another time where the categorical differences come into play. Movies, you want to keep at the highest quality, including sound, because the channels are almost always going to be in surround. Of all the TV shows I have, though, Star Trek are the only ones that are not either stereo or mono.

So, my probable solution is to save a small amount of space and eventually use MP3 or *gasp* AAC in the next storage standard I decide on for TV shows. I’ll admit that the size difference is generally marginal, about 20 MB of space on a 30-minute show … but added up it starts to make some difference.  Not big enough that I’d switch my entire library, but if I do end up converting the video mostly because I want to save space, then I might as well do the same for audio if I’m never going to use AC3 for its nice feature.  Either way, if I’m switching to MP4, then I have to, no matter what, as the format won’t support Dolby or DTS.  Plus, there should be receivers out there that support AAC.  I think.

A/V sync

This is the one that got me started thinking about the whole thing, which is actually quite funny considering how much time I spent on the problem, and the incredibly simple solution.

One of my main, longstanding issues with re-encoding my DVDs from MPEG-2 to MPEG-4 has been A/V synchronization. Having the audio off by just a few milliseconds drives me insane, being the observant freak that I am. Which is also one reason I won’t reencode anyway, because I can notice slight video artifacts, and it’s simply more mentally relaxing knowing I didn’t make any changes to the original stream. Ah, the wonders of obsession.

I spent a lot of time playing with encoding options, frame rate settings, etc. to find that perfect mix of configuration harmony where everything would be perfectly in sync so I wouldn’t go insane trying to watch Looney Tunes. I never found that secret combination, but I did learn a lot in the process of what was throwing it off and why. Plus I learned early on that there’s never a magic bullet for re-encoding that will work on every source material.

However, I still had some audio/video sync issues on some TV shows, even with minimal transformation on my end (from DVD straight to MKV, MPEG-2 with AC3). The solution was really simple: I just mapped the Channel Up and Channel Down buttons on my MPlayer configuration to change the A/V sync by 100 milliseconds in either direction. That way, when I can visibly detect the difference, I’ll just tap a button on my remote and all is happiness. Much simpler.

MythVideo

One last problem, or set of problems, I ran into, was with mythvideo itself. I’ve documented those pretty extensively over the course of my blogging. Everything I ran into, though, my proposed solution was to pretty much just sit around and wait for someone to fix it. I never would have imagined years ago that I’d eventually just open an editor, spend a few hours trying to hack on the source code, and actually manage to fix them myself.

Granted, they were all really, really, really small issues … nothing major like adding a TV tuner to the supported hardware list, but the fact that I managed to hack it out still impresses me, no matter how tiny the changes. That’s just cool.

Interesting stuff, I think. This is one of those posts that I look over and think, “my heck, everyone is going to think I’m this maniac nutball who obsesses night and day over a stupid collection of cartoons on a computer” and I start to wonder if I should hit that publish button. The reality, though, is that any subject that I get really fascinated, interested and involved in, I look at it from a whole lot of different levels. And if finding that perfect solution is just a matter of time, research and dedication, then I’m definitely up for the task. It has, of course, taken me a matter of years to learn all that I have, so consider this the side notes to everything I’ve figured out so far. Fun stuff.

weekend multimedia notes, part two

Monday, October 13th, 2008

Well, I had fun last weekend writing up just general notes about multimedia stuff I was playing with, so I think I’ll have a go at it again.

For some reason, this weekend, I got it in my head that it would be a great idea to look at the MP4 format again, to maybe put a few video files in, for portability. Which of course makes no sense, because I’m not streaming or sending my files anywhere at all except from one linux server to one linux client. But, vague issues of necessity never stop me when there’s something exciting and new to learn, so away I went. After playing around for a few hours, I came to the conclusion that things really aren’t quite up to par (for me, that is, the perfectionist), and that there’s no chance of me switching from Matroska any time in the near future.

The first snag I hit was that MPlayer wouldn’t report the aspect ratio or the bitrate on the files. At first I thought it was just happening on .mov files I had downloaded from Apple, but even with MP4s I created myself it was happening. Poop. Bitrate I can do without knowing, I was just curious, but ignoring the aspect when the original source is non-standard causes issues.  Edit: I should have known this, using the lavf demuxer works fine.  midentify -demuxver lavf movie.mp4

I started making a DVD of Star Wars trailers for my little brother (yay, trailers!), and I was reencoding them using ffmpeg. Lemme go off on a bit of a tangent here and say that as much as I love MEncoder, sometimes ffmpeg is just a wee bit simpler to throw out some quick changes. “ffmpeg -i foo.mov -target dvd -aspect 16:9 foo.mpg” is just too easy to remember. Obviously I could create a profile for mencoder, but I do that all the time, and then forget which ones I have. Not too helpful. Anyway, the trailers were actually already cropped so it was more like 2.3259 or something like that instead of 16/9. FFmpeg couldn’t read the aspect ratio, so I had to figure it out myself. I’m sure there’s a simpler way, but I just dumped the Apple trailer into Matroska first, got the ratio from there and then reencoded it. A bit of a run around, but it was fast, simple, and got the job done. Of course it might be a problem if your source material was longer than 90 seconds. Good luck with that.

Oh yes, I think one reason I wanted to play with MP4 was to see if I could get something to play back on my PSP. I have this wild-eyed dream of using my PSP to remotely stream video content from home. Unfortunately, it’s a royal pain in the pooty to even get something to encode for them. I really didn’t throw much effort into it, but quickly tried the first example I found online to encode it using ffmpeg, and it didn’t work. Meh. I tweaked the settings a bit to see if that helped, but nothing worked. Can I just throw in, again, even though it didn’t work for me, that ffmpeg is cool like that — it has a PSP format that it’s preset to encode to, along with a bunch of other ones … see “ffmpeg -formats”.

Actually, ffmpeg’s output was annoyingly confusing, now that I think about it. I couldn’t figure out for the life of me what the actual command line option was for the vcodec and acodec option. Anyone else run into that problem? I seriously couldn’t figure out which one was the AAC option. Aargh! “ffmpeg -formats” would just say aac, so of course I tried that, but it didn’t work. The option was actually libfaac. I have no idea in the freaking world how people are supposed to figure that one out. I read the entire man, and it didn’t really give much help there, either. Bleh.

One nice thing about the older releases of ffmpeg was that you could just say “ffmpeg -i foo.avi foo.mp4″ and it would automatically select mpeg4 video and aac audio for you. I switched over to using just SVN, and it wouldn’t do that for me, sadly.

Oh yes, one more thing I remember about MP4 (I am *really* bouncing around in this post), was that when I first read up about it, I discovered that the format supports MPEG2 video, which got me really excited. What surprised me was that Dolby Digital and DTS are not supported. AAC is the multi-channel choice, it seems. Still, I could live with just having to re-encode my audio. I hate waiting on video. Just a preemptive defense here, but say what you will about my MPEG2 choice of codec, but there’s something to be said about using a video codec that has been around for a long, long time and is extremely well supported in all kinds of software.

Playing with MP4, I found three ways to make one: using mp4creator (part of mpeg4ip package), ffmpeg, and mencoder. mp4creator was nice, but somewhat lacking in features — that is, comparing to mkvmerge (for Matroska). I’m not trying to bash it, since it did exactly what I needed it to do in every case, but it could be a bit more polished. I’m sure that’ll come with time, though. Once I had a movie file with MPEG2 and AAC, it wrapped it just fine, assuming it was named with a suffix it understood (complained on .vob, took .mpg fine). I’ve read that MP4 supports VobSub, and I wonder how someone would about putting that in there. Interesting stuff. I’ll have to play with it later.

FFmpeg I already mentioned. My biggest headache was just trying to figure out how to what the options were. In reencoding an MPEG2 video and AC3 audio to same video and AAC audio, for some reason, the resulting .mp4 file had blocking artifacts on playback. I have no idea how that happened, since I just copied the video stream directly. So, I couldn’t really use that to just quickly create one.

MEncoder worked best of all, even though it screeches at you (using SVN) that the LAVF muxer is broken, everything worked perfectly fine. I used something like “mencoder movie.vob -of lavf -ovc copy -oac faac -o movie.mp4″. No blocking issues, sound worked fine, everything was great.

So, that was my short lived trial with MP4 for the weekend. I’m actually really surprised that it isn’t as well developed / supported as I thought it would be. I thought that this was the hawt new thing in codecs. Like everything else, I’m sure support for it will improve in time. I figured there was a lot more options right now, though. I wish Matroska was supported on more commercial platforms, because I still think it blows everything out of the water.

Anyway, going all the way back to my custom DVD. I’ve been ripping my Star Wars trailers off the DVDs to make a new one of just all the trailers. I have the original theatrical release DVDs for the original trilogy, and unfortunately they don’t come with any trailers *at all*. Super bummer. Episodes one through three, though, have a ton. Episode III has 18 trailers total on it. Sheesh! It was a bit of a pain trying to find them all, too.

One thing that surprised me was that with all the trailers on the Episode I disc (seven), I noticed that one of them was missing. I can’t believe I even know that. I guess I am a nerd. But there’s this one really memorable trailer which starts off with Anakin pod racing, and it’s incredible. I’ll have to find it somewhere else, I guess.

As much as I’ve written, believe it or not, I did all of this within about four hours time. It was a fun weekend. In fact, I wasn’t even on the computer until Sunday afternoon. Good times.

pimp my mythvideo: coverfiles made simple

Monday, October 6th, 2008

his being my third patch to fix some mythvideo nags, I’m actually starting to get comfortable going in there and trying to find this stuff. It’s still incredibly difficult to try and figure this out, since there’s little documentation and I vaguely understand C++, but it’s fun to attempt and cool to succeed.

This patch fixes an annoying problem I’ve had for a long time — it’s a royal pain setting a cover file for a video. A cover file would be the actual image that shows up in the gallery view for a media file. Without one, you just see a blank little icon which is pretty boring.

Folders are really simple — you just add folder.jpg (or .gif or .png) to the directory, and it will show that. Individual files are a bit tricker. If you were just using the interface, you’d have to first go into the Video Manager to let Myth scan the directory of files, create an entry in the database, then go find the file, edit the entry, and set the coverfile manually.

I originally wrote a script to do that part for me. I would just create a JPEG image for each media file, usually with the same filename, but a different extension, and code in a check to see if both exist, update the videometadata table. All the time, I kept thinking though, it would be so much simpler if Myth would just check to see if the file existed like the folders, and display it. That’s exactly what this patch does.

I pretty much just copied the same code from the part where it looks for the folder icon, and did the same thing. If, for example, you have movie.avi, just create movie.avi.jpg (or .gif, or .png) as the coverfile and you’re done.

Actually, you do have to put the file in the database first, since it still checks to see if there is any metadata for it at all. That is extremely simple, though, either by script or UI navigation. The UI will just add new ones quietly, and you can quickly exit out. The patch will still use your coverfile in the videometadata table too, if there isn’t a similar filename that it can find, so you can apply this and it won’t break your existing setup.

As usual, the ebuild is in my overlay. This one is mythvideo-0.20.2_p15087-r3.ebuild. I’m going to eventually document these a bit better and file bugs with upstream. I know I’m using an “old” version to patch it onto, but the reality is that SVN hasn’t changed at all since that revision, so even the latest version bump is the same code.

I also spent the weekend working out a number of small kinks in my system and setup. I drafted up a new “wishlist” that I have of stuff I’d like to eventually get fixed, and it’s getting smaller all the time. Right on.

As far as mythvideo patches, though, I only have one last small annoyance that, while it doesn’t really bother me, does kind of throw me for a bit of a loop so I’d like to see if I can fix it. The bug is that folder names and file names are sorted differently. I can’t remember which is which off the top of my head, but one of them will ignore prepositions like “The”, and “A” on the front of titles and sort by the second words. So “The A-Team” would show up near the top of the list. Maybe it does that on both file and folder. Anyway, I don’t like it. It’s a bit confusing. I tried looking for where it does that, but I haven’t had much luck yet.

weekend multimedia notes

Sunday, October 5th, 2008

I’ve been spending part of the weekend working out small annoyances in my myth setup, trying to get it inching closer to my “perfect” setup.  I’m actually really close now, minor stuff is all that’s left.

Here’s a few things I want to remember as a point of reference, that took me a bit of research to figure out:

Printing options in MPlayer:

mplayer -list-options <command line arguments>

mplayer -input cmdlist <slave mode commands>

mplayer -input keylist <events>

Mapping Page Up and Page Down with my remote in MythTV:

begin
prog = mythtv
button = ch+
repeat = 3
config = PgUp
end

begin
prog = mythtv
button = ch-
repeat = 3
config = PgDown
end

Finally, I hit some snag with MPlayer and VobSubs (subtitles that originally come with DVDs).  I’ve got some movies in Matroska format, and with recent (SVN r27719) revisions, it will forcibly display the subtitles on playback, and I have no idea why.  I swear I remember reading something about this on the mailing list a while ago, but I haven’t had much luck finding anything.  Best option so far, go back to an earlier revision (r25993).  Not ideal, but it works.  Every sub, force and vobsub option I’ve tried does nothing.  I’m not passing anything by default like -slang or -sid to mplayer.

Another thing I’ve been working on (I’m really bored) is finding posters for the cover images in my movies folder.  Which got me looking at UK quad posters.  If you haven’t ever seen the posters from across the pond, they are so much better than our American counterparts.  They are a horizontal landscape, which allows for, in my opinion, a much more dramatic picture.  Check out this Star Wars one, for example.

It just looks so much better, in my opinion.  I gotta get some movie posters up on my wall (only two so far: Tron and The Adventures of Milo in the Phantom Tollbooth), and I’d love to hunt down some quads.  The old school Disney ones look even awesomer.

Speaking of cover images for Myth, I have a new patch I cranked out last night, which has an interesting story to it.  I’ll post details later, though.  I’m not in the mood for details right now.  I’m more about hunting down stupid bugs that don’t require too much brain power.

playlist resume

Wednesday, October 1st, 2008

I wrote about this a little bit a while back, wrt mplayer-resume, that I wanted to work on a way to resume playback from a playlist as well using MPlayer. Well, I finally sat down and figured it out last week. For some reason it took me a good while to figure out the logistics of how to do it rather than the coding. I dunno why. Anyway.

I wanted to wait to bump mplayer-resume until after I added something else, and this is gonna be it. Just gotta clean up the code and package it now, and it’ll be ready to go.

Here’s how it works though: the script, like mplayer-resume, acts as a wrapper to mplayer. In fact, everything is pretty much the same except that it saves both the filename along with the position in the playlist.

The problem I was having a hard time figuring out was that I wanted to easily make two options available: resume playback in the current file I’m in (old mplayer-resume functionality), and resume playback in the position in the playlist I’m in. I just finally mapped two keys on my remote, exit and stop, to take care of both of them.

Hitting Exit on my remote will save the playback of the current file and write that to the playlist position file. Then it also saves the seek time where I left off. Hitting Stop will kill the old entry and just add a line to the playlist saved position file that says what the *next* file should be on playback.

Pretty simple when you consider it, but it took me some time to figure out, mostly so that it seemed intuitive. I figured I’d have a hard time getting used to it, and hit stop accidentally and losing my place where I wanted to be, but so far it’s worked out fine. I’m happy with it.

I’m using it for playback of my TV shows, which is pretty much 95% of what I’ve got ripped on my media setup. I have a few movies, but no AC3 output, so I prefer to just stick those in my DVD player. It is the only way I can watch my Region 2 or 4 DVDs though. For TV, it works great, since I generally want to watch them in general succession of episode order. And if I don’t feel like watching a certain episode, you just hit stop and it’ll skip to the next one. Very nice. I suppose I could map a button to go *back* in the playlist if I screw things up accidentally, but I’m kinda running out of buttons to map on my remote. Besides, vague mappings that I’m supposed to remember usually hurt more than help.

pimp my mythvideo: another navigation patch

Friday, September 19th, 2008

I’ve been working on a bug all night I noticed the other day that really annoys me in Myth, and I stayed up poking at the code trying to find a way around it. Actually, it’s a little weird how I “discovered” it, since I always perceived in the back of my mind that there was something annoying, but never pinpointed it specifically what it was doing until this week.

The bug is this: when you are using gallery view in MythVideo and you enter a folder, when you exit back to the main root menu, it repositions that folder at the top, regardless of where it was when you entered the folder.

Some pictures will probably make more sense.

Here is a screenshot of what my folder display looks like when I enter MythVideo’s gallery for the first time, and browsing for a folder to select:

 

Now, when I select that directory, I’ll see the files in there. But when I hit Escape or select the previous folder icon, it will return me back to the root menu. However, the folder layout has changed, and the row that the folder is on, originally the bottom, is now at the top.

 

 

Moving around the position of the folder layout throws my brain for a loop every time it happens, because I’m expecting to see the same display as when I was just in there, and since it’s different I have to rescan the layout visually and reprocess where I am and where I want to navigate.

This patch fixes that, and keeps the layout the same when you return to the root window.

I went ahead and added a new ebuild in my personal overlay which will install it for you if you don’t want to patch it manually. The ebuild is mythvideo-0.20.2_p15087-r2.ebuild and it also includes my original navigation patch.

Now then, there’s one small bug in it that I’d like to fix, but I don’t know any Qt or C++, and it’s a miracle in itself that I managed to even get this far on my own. In fact, I’m quite proud of myself actually that I even figured this one out all by myself, go me. :)

I originally patched it so that it would just reposition the parent view around the last folder row you were in … that is, I was doing the same thing, but not specifically for the root menu, just any folder you went into. That worked fine, provided your tree didn’t have more than one level. The second you went into a third directory Home -> Foo -> Bar, the 2nd variable would overwrite the first one so when you returned to the parent it would be whacked. If that makes any sense. Anyway, for someone with Qt knowledge, it shouldn’t be hard to fix so that it always does that no matter which folder you are in, and at what depth level. I have no idea how, though.

It’s actually kinda interesting how I figured this one out. There were two things I noticed from poking around in the code. One, to get videogallery to dump out variables to stdout, I would add this to the code:

VERBOSE(VB_GENERAL, QString(”Some text.”));

VERBOSE(VB_GENERAL, QString(”Some variable: %1″).arg(someVar));

Yah, brilliant hacking on my part, I know, but I managed to kludge my way through it and figure it out.

The second thing I realized was that if I wanted to find out if I was on the parent tree or not, I would have to create a new instance of GenericTree and check to see if getParent() returned the main root or not.

GenericTree *lparent = where_we_are->getParent();

Then, if lparent != video_tree_root you would know you’re not at the top yet.

Anyway, yah, my awesome debugging skillz at work there, but hey — it took a lot of patience and more than a few rebuilds, but it worked, and I’m happy. Woots.

One last thing — the patch will also apply cleanly against current SVN (r18336 as of this writing) since it hasn’t changed in a good while, so you don’t have to use my ebuild if you don’t want, or you could just rename it to the latest snapshot in portage and it’ll still apply.

bend, drip, mythvideo

Tuesday, September 2nd, 2008

Here’s something I haven’t written about in a long time — bend, my custom written CLI PHP5 scripts to rip and encode TV shows.

I actually rewrote the entire thing over Labor Day weekend.  What’s amazing is it took so long to write the original one, but so short a time to completely revamp it.  It’s something I’ve been wanting to do for a long time, and I’m glad I finally got to it.  The code on the old one was so horrible, and was such a frustrating experience to patch, debug or add features.  The new one is already 20 times better.

The first one was just plagued by scope creep, though — I started off just mostly coding it around the way that I thought DVDs *should* work and how they ought to be authored, only to be constantly slapped in the face by so many exceptions that I’d have to go back and hack it to work around the new found realities.

One example is that either lsdvd or libdvdread is buggy in how it outputs chapter information.  Actually, my whole experience with chapters have been that if there are any oddities, then the players will just freak out.  You wouldn’t believe the cases I ran into.  Anyway, here’s a small example.  On one DVD, lsdvd will report in original output that one track has 30 chapters on it.  But when you go to display the chapters, it will only say that there are two.  Most of the time, what happens, is that it will choke anytime there is a chapter between others that is zero length.  In this case, lsdvd just chokes and stops counting them.  MPlayer (at least, the ancient version I’m using) will do a couple of things depending on its mood — sometimes freeze, sometimes skip over it, sometimes act like its not even there.  It’s very odd.  I’ve found a lot of interesting little bugs in the dvd libraries and tools.  I’d love to poke and the source and fix them up … when I have time.

The code is online in my svn repo, and the new one is called ‘drip’ for dvd ripper.  Original, I know, but eventually it will replace bend completely once I add in all the features the old one had plus all the new stuff I want.  I would throw in a link to trac which has prettier display output for viewing SVN files, but my installation is broken (again) and I have no idea why, and it’s always a royal pain trying to figure out what went wrong, so I’ll just fix it later.  I love trac, but its not easy debugging the setup.

Oh yah, also I’ve been working on my mythvideo setup, tweaking it even more.  One really thing that dawned on me, which I’ll write in more detail once I actually have a script ready, is that you can use it to execute shell scripts using the File Types admin menu.  Just tell it to execute .sh files in your folders with /bin/bash and away you can go.

Another thing I learned is that MythVideo will only pass two variables to any external scripts, the default player (%d) and the video file (%s), or more accurately, the file you’ve selected to run.  So if you wanted to see what you’re executing, you would add this to the file type for .sh files: /bin/bash %s %s

Then, say you had test.sh, this would be the contents:

#!/bin/bash

echo $a

I’m getting ahead of myself, though .. I’ll write more about that when I’ve got something to show.  I’m actually working on a shell script similar to mplayer-resume to resume playback of a playlist you’re in.  It’s a bit trickier than I thought it would (or rather, not nearly as simple as I had hoped), so I’m still scoping it out in my head.

Speaking of mplayer-resume, I fixed a bug I kept running into with it for a while now.  The script will now catch the exit code of mplayer, and if it’s not successful (zero), then it won’t overwrite or delete the old position.  I used to hit it all the time because I used to run mplayer -hardframedrop when playing my videos, which would crash the playback about 10% of the time and of course kill the file that had the playback position.  I need to repackage it and push it live, but there’s a few more small fixes I want to make to it first … I might finish the playlist resume script first and add it to there.  Plus I want to get trac working, because that’s where it’s homepage is.

But, I moved my mini-itx to the living room and hooked it up to my HDTV.  It was sitting in my bedroom just collecting dust, and I figured I might as well move it to see if it gets any more usage.  Actually, I remember now, I moved it was because the LED lights were really bright in my bedroom at night, and I have to sleep in total darkness to get a good night’s rest.   Anyway, it’s worked out well so far.  My TV has a VGA port so it’s super simple to plug it in, not to mention I like the fact that it doesn’t use up an HDMI port.  I love my TV. :)  Once I have this series playlist resume script finished, I think I’ll be pretty much “done” with having the setup that I’ve wanted so long.  Well, aside from the fact that I need about 12 more terabytes of harddrive space.

Good times, I tell you what.  I’m gonna go watch some Star Trek TNG.

mplayer + dvdnav + dvdread svn ebuilds

Friday, August 15th, 2008

I updated the mplayer and dvdnav ebuilds in my small overlay, and added one for dvdread now, which has been split into a separate package.  I haven’t had time in the past while to keep an eye on what’s been going on, but I do know that the heavy flurry of development has stopped, and that the installer works better.  Plus, the software works fine for me. :)

My overlay isn’t in layman right now, so if you want to check it out, here’s the skinny:

svn co http://overlays.gentoo.org/svn/dev/beandog/

Have fun and lemme know if there’s any problems.

mplayer and transcode fixes

Thursday, July 17th, 2008

Since things are finally starting to settle down (hey, I’ve had Internet for a week now, cool), I’ve started getting back to poking at stuff, slowly. Today I cleaned up some mplayer and transcode stuff in the portage tree, and I just thought I’d mention what’s new.

First of all, mplayer. The latest revision is 1.0_rc2_p27120. The snapshot itself is about a month old, and I don’t know of anything particularly major that’s in there (I haven’t had time to follow development for the past month anyway). It’s been masked for testing, not because upstream has done anything funky, but because there are some new use flags, which have helped me to go back and clean up some stuff that I should have done a long time ago. I haven’t heard a peep from anyone on bugzilla so either no one’s tried it, or it works great.

The big changes that I can think of off the top of my head are this: first of all, there’s an ewarn added if you enable the cpudetection flag. It finally dawned on me that this one might not make sense. Here’s what it *doesn’t* do — magically make the build detect and build for your CPU architecture. The build system already automatically detects and installs with the correct instruction set by default, using stuff like MMX, SSE, and friends. The only reason (that I can think of) that you would use that, is if you were deploying the binary package on another computer, since it is a runtime feature, not a buildtime one. So, you’ll get a little warning if you enable it, because, in general, desktop users don’t need it. I also fixed the use.local.desc to be a bit more specific as well.

Secondly, there’s a new use flag: custom-cpuopts which should finally solve the long-standing dance of trying to outwit users who always break their system but still allow real tweakers to do exactly what they want. Here’s how it works. MPlayer’s build system, again, by default, will automatically detect the CPU optimizations that are supportd for your platform (MMX, SSE, again, etc.). That means that, again, if you leave everything by default — it should work fine.

Originally the problem we would have is that people would have their CPU optimization use flags turned off (like mmx), which would normally break the build. The ebuild is written to only disable them if they are turned off, so my solution for a long time was to tell people to just turn them all on and let MPlayer *not* disable them, therefore, revert back to autodetection. This would then cause problems, though, for those few who were building MPlayer for some other box, and they wanted specific CPU opts on or off. This use flag will fix just that.

What custom-cpuopts will do, when enabled, is forcibly enable or disable the actual CPU optimization use flags you set. This will help out those on certain profiles and setups who need to tweak their build for whatever reason. For normal desktop users, you don’t need to enable it — if it’s turned off, the ebuild will completely ignore the other use flags (for CPU optimizations) and just use the default checks … which work great. It also means that your build will be optimized the best it can, yay!

I know I really went into depth on that one, but it’s been an issue with the build and users for a long time and I’m glad I finally got a cleaner solution working. Now everyone has the options to do whatever they want, but by default, everything should build and be optimized wonderfully.

Oh yes, one last thing — if someone wants to fix bug 228799, and submit a patch upstream, I’d be extremely grateful. That would clean up the LINGUAS hack in our ebuild, which I’ve heard breaks on paludis anyway.

As far as transcode — I’ve been out of the loop, and the media-video team has been taking things over and cleaning up (I don’t even know who, sorry guys, haven’t taken the time to look into that either — I know loki_val fixed up some imagemagick / ffmpeg dep crap that I didn’t want to touch, thanks man!). 1.0.5 is back in the tree, and should be the next stable candidate. I also added another rc for 1.0.6, and I have to add the 1.10 beta sometime.

That’s about it for now. Have fun. Go break your box. :)

charlie the unicorn ringtone

Thursday, June 12th, 2008

Okay, this is great. This morning at work we were talking about YouTube videos, and then cell phone ringtones, and we got the awesome idea — let’s make some ringtones from YouTube videos! Sweet!

So I downloaded the incomparable video Charlie the Unicorn, used audacity to cut out the Candy Mountain song, and then uploaded it to my cell phone with Bluetooth using my co-worker’s Mac. Freaking right on.

It’s a mecca of love, the candy cave!

Okay, so if you wanna know the technical details, here’s specifically what I did:

Download the youtube video using youtube-dl:

$ youtube-dl -b -t “http://youtube.com/watch?v=Q5im0Ssyyus”

Extract the audio to WAV format using MPlayer:

$ mplayer charlie_the_unicorn-Q5im0Ssyyus.mp4 -ao pcm:file=candy_mountain.wav

Edit the WAV file with Audacity, select the song portion, and export it to MP3 with a64 kbps bitrate. The start point was 2:26 and it’s 42 seconds in length

$ audacity candy_mountain.wav

And that was it! Instant ringtone goodness. :) Here’s the MP3.