Wednesday, March 26, 2014

Some Video Notes

If you've used youtube-dl from the command line lately, you may have noticed some breakage when passing a Youtube link to a video player, such as:

mplayer -quiet -framedrop -cache 8192 cache-min 10 $(youtube-dl -gf 18 "http://www.youtube.com/watch?v=aP_-P_BS6KY")

Homie won't play that. It's 'cause lately Youtube has been returning HTTPS links which Mplayer and VLC can't stream. As a temporary fix, youtube-dl's developer added the option "--prefer-insecure" which, when added to the youtube-dl command, will return HTTP links which Mplayer and VLC can play.

mplayer -quiet -framedrop -cache 8192 cache-min 10 $(youtube-dl -gf 18 --prefer-insecure "http://www.youtube.com/watch?v=aP_-P_BS6KY")

Mein developer cautions that this could break at any moment and that he'll look for a more permanent fix in the future. ***UPDATE: This no longer appears to work. OS X users can instead use PPC Media Center, and Linux users can try Mpv.***

This situation (I've upgraded the severity from snafu to situation) can also adversely affect any Greasemonkey scripts you have for link extraction, though in my observation it's hit and miss. Thankfully none of this seems to affect OS X's PPC Media Center, but if you're on Linux or utilizing scripts that have command line args, you'll definitely want to upgrade youtube-dl (youtube-dl -U) and try out the new option.

Also Youtube related, Nathan left a comment on my Some Cross-Platform Flash Alternatives post and mentions Minitube is now available for Debian Jessie and also works on Wheezy by...Well, I'll just let him explain it:
Another Flash alternative you can do is downloading the Debian Testing version of Minitube here: https://packages.debian.org/jessie/minitube . It works perfectly if you install it on Wheezy with dpkg, and then do a "sudo apt-get -f install" to install all the required dependencies. You can then add Minitube to Open With (It's in /usr/bin), and simply right-clicking any link to a YouTube video will open it in Minitube.
Cool!

And one final cool thing, there's a new fork of mplayer2 called mpv. It's available in Jessie, too, though I haven't tried using the above method to get it onto a Wheezy box. I never liked mplayer2 'cause it used a bit more CPU than MPlayer, but mpv seems to have fixed that. Also, G3 users will be happy to know you won't have to compile it with the configuration option "--disable-altivec" to prevent a crash when playing video. Mpv works out of the box, no compiling necessary.

Now let's get back at the productivity Nazis at Lifehacker and watch some frickin' videos at work!

Saturday, March 22, 2014

Compton Comes to Debian

(EDIT: This is also excellent for LXDE in case any of you got the impression this was for Openbox only.)

No, not the city, the compositor. Compton is a compositor program, like xcompmgr or cairo-compmgr, that adds effects to your desktop such as shadows and transparency. In fact, Compton is actually a sequel to xcompmgr that aims to improve and expand on the original with a whole host of bug fixes and new features, in particular adjusting window opacity.

Adjusting window opacity--for example, making all background windows transparent--is a feature I've been wanting for a long time. On OS X, there used to be an input manager called SetAlphaValue that did this, but it only worked for Cocoa windows and didn't work for the Finder or iTunes. For Linux, XFCE has had its own built-in compositor for awhile, and it's probably the only thing that's tempted me to switch, but I'm determined to be an Openbox loyalist. Xcompmgr is what we were stuck with, until Compton came along. The only problem was it wasn't in Debian's repositories, and for some excellent reason which is now completely lost to me, I never tried compiling it. But I don't have to dwell on my laziness anymore, because Compton has now arrived. It's now in the Jessie and Sid repositories, which I just noticed a week ago.

So after installing it, what do you do with it? Well, like xcompmgr, you can input all the settings from the command line (-cCf -D1 -t -8 -l -13 -r 10 -o .4), but with Compton you can also put all that junk in ~/.config/compton.conf and just enter "compton -b" in your autostart file (the -b daemonizes it). Here's my compton.conf:

# Shadow
# Enable client-side shadows on windows.
shadow = true;
# Avoid drawing shadows on dock/panel windows.
no-dock-shadow = true;
# Don't draw shadows on DND windows.
no-dnd-shadow = false;
# Zero the part of the shadow's mask behind
# the window (experimental).
clear-shadow = true;
# The blur radius for shadows. (default 12)
shadow-radius = 7;
# The left offset for shadows. (default -15)
shadow-offset-x = -11;
# The top offset for shadows. (default -15)
shadow-offset-y = -8;
# The translucency for shadows. (default .75)
shadow-opacity = 0.5;

# The shadow exclude options are helpful if you
# have shadows enabled. Due to the way compton
# draws its shadows, certain applications will
# have visual glitches (most applications are
# fine, only apps that do weird things with
# xshapes or argb are affected).
# This list includes all the affected apps I
# found in my testing. The "! name~=''" part
# excludes shadows on any "Unknown" windows,
# this prevents a visual glitch with the XFWM
# alt tab switcher (also prevents shadows on
# Openbox menu, so I commented it out).

shadow-exclude = [
# "! name~=''",
"name = 'Notification'",
"name = 'Plank'",
"name = 'Docky'",
"name *= 'Firefox'",
"name *= 'VLC'",
"name *= 'Chrome'",
"name *= 'Chromium'",
"class_g = 'Conky'",
"class_g = 'Kupfer'",
"class_g = 'Synapse'",
"class_g ?= 'Notify-osd'",
"class_g ?= 'Cairo-dock'",
"class_g ?= 'Xfce4-notifyd'",
"class_g ?= 'Xfce4-power-manager'"
];

# Opacity
# The opacity for menus. (default 1.0)
menu-opacity = 0.94;
# Default opacity of inactive windows.
# (0.0 - 1.0)
inactive-opacity = 0.6;
# Exclude applications from opacity.
focus-exclude = [
"name *= 'mplayer2'",
"name *= 'VLC'",
"class_g = 'XScreenSaver'"
];

# XRender backend: Step size for alpha pictures.
# Increasing it may result in less X resource
# usage, though some of your effects may become
# disabled.
alpha-step = 0.04;

# This prevents opacity being ignored for some
# apps. For example without this enabled
# xfce4-notifyd is 100% opacity no matter what.
detect-client-opacity = true;

# Keeps Openbox OSD focused.
mark-ovredir-focused = true;

# Limit Compton to repaint at most once every
# 1 /refresh_rate second to boost performance.
# Incompatible with certain VSync methods.
sw-opti = true;

# Unredirect all windows if a full-screen
# opaque window is detected, to maximize
# performance for full-screen windows.
# This option prevented my Openbox desktop from
# loading when put in my autostart file, so I
# commented it out.
#unredir-if-possible = true;


Basically, this creates subtle shadows around windows and menus and makes all background windows transparent. Also, menus are slightly transparent. There are some glitches as not every application draws windows exactly the same, but as you can see, you can enter exclusion rules for both shadows and opacity if any are giving you problems. The excluded applications are from sample compton.conf files I copied and pasted from the web (obviously I'm not using Chrome), but I've added the opacity exclusions for my screensaver and video players. Also I found a couple of Openbox-specific glitches that are noted in the comments.



So, looks good, you say? But what about performance? Surely this luxurious fanciness slows your desktop to a crawl, does it not? Well, I don't have 3d acceleration on this laptop, so I have to use the XRender backend instead of glx. And even then, performance is good. Menus and window switching are slightly less responsive, but not enough to be annoying. CPU usage increases, but it's only momentary. All-in-all I give Compton an A+ and think maybe it's time for a Jessie upgrade on all my computers.

Saturday, March 8, 2014

PPC Media Center Update

Just a quick FYI, Adam A.'s youtube-dl GUI wrapper that I posted about has been updated to support Comedy Central while cutting out the commercial breaks. Here's the Mediafire link (outdated: see above link for updated version), and I'll always keep the original post updated with the latest version, too. And if you haven't downloaded this yet, really, you must. We won't hold your previous delinquency against you.

Tuesday, March 4, 2014

Hmmm...

I don't know what this is about, but I'll leave it here to get your hopes up ;-)