… when we first practice to watch some movies

As I’m sure you remember from yesterday, I got an external HDMI screenshotting box to do screenshots while watching films from Amazon Video.

That worked fine, but using an infra-red remote to trigger the screenshots is slightly awkward: The line of sight thing means that I either have to have the (not very pretty) box in line of sight (and pretty close by), or I had to use an IR repeater of some kind.

Yay. More gadgets.

But then I though… “This box can also record video! Let’s try that!”

The upside here would be that I could just play the videos on my normal Linux machine, and everything would, like, work the way I wanted, without stressing with the Ipad, using remotes, switching the source, etc.

Besides: Freedom!  DRM is obnoxious!  You’re not the boss of me!  Etc!

Let’s have a look at today’s experimental set up:

First of all, a nice and big SD card is necessary, since the recorded H.264 (AVC) video files the recorder box creates rather big files. (About 12GB for a film.) So I use my normal filming card for this, which has the added advantage that it’s an UHS-II card (Ultra High Speed: The Second!). Note all the additional contact points on the card.

The “HDMI splitter”, the Aven video recorder, and the hated HDMI switch (which I no longer need, kinda).

And instead of using my ginormous Ipad, I got a used Iphone Touch (6th gen) cheap. I didn’t know whether that would work, but look how much smaller it is! It’s much more practical than carrying the Ipad around and plugging in here and there…

Finally, my USB 3.0 UHS-II SD card reader to transfer the files to my computer. I get about 100MB/s reading speed with this setup, so transferring an entire film takes less than two minutes.

I had a peek at a recorded film (a review of which will be coming to these very pages later today, I guess?) and it looks nice. The video is a bit “soft”, but no more artifacty than the film I watched directly from my Ipad yesterday. We’ll see…

But! I then thought that it would be nice to trim down the recorded bits to the actual film length (since I had forgotten that it was running and there were two hours of blackness at the end of the file), so I loaded it up in LightWorks…

And the exported film had an audio/video mismatch of over three seconds.

Whaaa!?

And that program re-encodes everything, so I didn’t really want to use it, anyway. So I installed avidemux, which had a very strange interface, but managed to chop off the black parts at the end without re-encoding. Very fast.

And the resulting file had a six second audio/video lag.

Wat.

Just about to give up, I found Lossless-Cut, a simple editor written in JavaScript (!) that uses ffmpeg under the hood.

I loaded in the file, set the start and end points in the excellent and easy-to-use editor and clicked “save”. Amazingly fast, it saved the resulting file at 100% of theoretical disk bandwidth speed, and…

The audio/video sync was perfect!

Whoho! Go JavaScript!

But is this a sensible workflow for watching films? Eurhmn…

Freedom!

The Tangled Webs We Weave…

My mission: To watch films from all around the world.  My problem: Many films are only available on Amazon Prime (US Edition).  My solution: Errr…

In this part of this (seemingly never-ending series) I’ve reached the point where I’m able to watch Amazon Prime videos, but taking screenshots while doing so (AND I HAVE TO DO THAT, DON”T I?  DON”T I?!?!?!) is still not solved problem.

Until today!

I can watch (and screenshot) on my Galaxy View Android device, but it seems to all be in lo-def, and I really want HD and on my TV.  So I got an Apple HDMI dongle for my Ipad and a box for screenshotting.

But that didn’t work, because DRM.  The box doesn’t support HDCP, so the Amazon Prime app just refused to output anything.

So!  I got a (euphemistically named) “HDMI splitter”, which is really an HDCP stripper.  Figuring out which ones work this week means reading the very newest comment on Amazon and taking a chance.

AND IT WORKS!

So here’s the setup tonight:

First the Ipad to the HDMI dongle…

Into the “HDMI splitter” (cough cough HDCP stripper cough cough).

Into the Aven screenshotting box.

Into an HDMI switch (that I had to add since I now have more than one HDMI source).

Into a CEC command injector device (that I added earlier).

Into the TV!  That’s just like 20 meters of cables and stuff.

And as you could see in the previous post, it works.  (I stuck a FlashAir card into the Aven box so that I can pull down the screenshots automatically into Emacs.)

See?  IT”S SIMPLE!

DRM.  Digital Customer Fuckery.  I’m sure that’s what it stands for.

But as you can see, the picture quality from this setup is fine, although it was choppy.  For the next film, I’m going to use the same setup, but download the film onto the Ipad in advance.

Stay tuned!  In about two hours you’ll know the results!

Ipad, Screenshots and Linux

It’s become increasingly clear over the past few months that many recent, fun-sounding films from countries with smaller film industries will never get a physical DVD release. The only way to see these films is via Amazon Prime, and since Amazon Prime isn’t conveniently available on Linux machines, I’m having to use an Ipad to watch these films.

Which is fine.

But I have to take screenshots. (I mean. I have to!) That leaves a lot of images on the Ipad, and I need a convenient way to get those from the Ipad to my Linux laptop.

Now, there’s Dropbox, and… stuff, but all those things require some manual work at the Ipad end or the Linux end. I hate manual work.

So wouldn’t it be nice if there was some way to just “do something” and then all the screenshots from the Ipad would magically appear in my Emacs on the Linux laptop?

There is!

It’s a bit fiddly, though, so let’s just get started.  (“A bit fiddly” is code for “seven pages of text is to follow”.  This is the year of Linux on the Desktop.)

My Laptop runs Ubuntu Linux, and it comes with an ifuse distribution that’s built with GnuTLS and not OpenSSL. This doesn’t work with IOS 10, so you need to build it yourself.

I’ve streamlined the build instructions a bit. The utilities and libraries needed to talk to Idevices is spread over four repositories, but the following should pull them all down, build them, and install them under /usr/local.

#!/bin/bash 
sudo apt-get build-dep ifuse 
for elem in libusbmuxd libimobiledevice usbmuxd ifuse; do 
  git clone https://github.com/libimobiledevice/${elem}.git 
  (cd $elem; sh ./autogen.sh; make; sudo make install) 
done

Check that your path is picking up the correct version by saying

$ type ifuse 
ifuse is /usr/local/bin/ifuse

Then plug in the Ipad via USB, and test that you can talk to the device. You may have to press “Trust this device” on the Ipad while connecting.

$ sudo mkdir /media/ipad 
$ sudo chown larsi.users /media/ipad 
$ idevicepair pair SUCCESS: Paired with device 37b633350ab83dc815a6a97dcd6d327b12c41968 
$ ifuse /media/ipad

You should now have the Ipad mounted, and the screenshots are under /media/ipad/DCIM.

Now for the fun part: Make the laptop copy over the files automatically whenever you plug in the Ipad.  I’m using the general setup from the usb-automount setup I did a few months ago.

The main difference is this udev.rules file:

ATTR{idVendor}="05ac", ATTR{idProduct}="12ab", PROGRAM="/bin/systemd-escape -p --template=usb-automount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c"

And then I use the following script to actually copy over the contents to the current “viewing directory”.

#!/bin/bash

command="$1"

if [ "$command" = "remove" ]; then
    umount /media/ipad
    exit
fi

# Mount the Ipad.
ifuse /media/ipad

if [ -d "/media/ipad/DCIM/100APPLE" ]; then
    cd /media/ipad/DCIM/100APPLE
    for pic in IMG*; do
        to="/home/larsi/pics/ipad"
        if [ ! -f "$to/$pic" ]; then
            cp -av "$pic" "$to/$pic"
            chown larsi.users "$to/$pic"
            if echo "$pic" | grep PNG > /dev/null; then
                shot=`echo "$pic" | sed 's/IMG_/shot/' | sed 's/PNG/png/'`
                if [ ! -f "/home/larsi/.movie-current/$shot" ]; then
                    ln "$to/$pic" "/home/larsi/.movie-current/$shot"
                fi
            fi
        fi
    done
fi

cd /
umount /media/ipad

Or something like that.  You obviously have to adjust the script to your needs if you want to do something like this, but the general idea should be sound, I think…

Look!  The images appeared in Emacs!  As if by magic!

It seems to work reliably, also after rebooting the laptop.  Apparently the “idevicepair pair” think only has to be done once?  Or something?

The only minor annoyance is that Ubuntu pops up an icon in the right-hand menu every time I plug in the Ipad.  Is there any way to say to Ubuntu “ignore this device in the UI”?  There is a way to make Ubuntu ignore all auto-mounted devices, but that’s not what I want, and there is a way to make Linux ignore a specific USB device completely (echo 0 > /sys/bus/usb/devices/2-1/authorized), but that’s not what I want, either.  I just want the UI to ignore this specific device…

Oh, never mind.

[Edit: I’ve now put the scripts on github.  That should make it easier to customize if anybody wants to use this setup…]

My New Concert Blog vs Useful Consumer Review

I’ve been using a Panasonic GH4 camera for a couple of years to do concerts.  It’s a very nice camera, but it has a few problems.  1) When recording video, it splits the video into 4GB chunks that I then have to piece together.  It’s not a biggie, but it’s annoying.  2) More seriously, the microphone on that camera kinda sucks.  Whenever there’s a really steep sound gradient, it freaks out and goes into white noise, which means that I’ve had to discard more than a few recordings.  IV) It’s big and bulky. f) I use it for other things, too, which means that I have to swap settings and SD cards all the time.

So I got a Panasonic GX85!

.

I’ve been using it for some weeks now, and it’s pretty spiffy.  All the previous concerts I’ve done with the camera have been very low-volume affairs, so I had no idea whether the microphone works or not in high volume environments.  Until tonight!

Excuse the wobbly camera work, but I was resting it on my knee.  But the sound is kinda OK, eh?  And it was pretty loud.

So I think this camera’s going to work out.

One funny quirk about the GX85, though, is the EU video length limit.  In case you didn’t know, in the EU, things termed “video cameras” are subject to a pretty steep tax.  Camera producers work around this by limiting their cameras to 29:59 minutes, because they don’t have to pay the tax.

When filming in most modes, the GX85 camera heeds that limit, but it appears that the Panasonic people “forgot” to program that limit when you’re doing 4K video.  Then you can film as long as you want.  Or until the battery runs out, which takes more than two hours.

So…  From now on, the concerts I post on Youtube are going to be in 4K.  You can thank Panasonic and their absent-minded engineers.

CEC HDMI ETLA

I’m extremely lazy, so using a remote control to switch the TV on or off is just out of the question. The remote is just languishing in a cupboard somewhere, and the TV is always on. Which seems like a waste, since I only use it (like) a couple of days a week or something.

Most of the time it just functions as an xscreensaver-enabled display to show the sleeve of whatever album’s playing on the stereo.

But then! The other week a friend told me about something magical called “CEC”, which is apparently short for Consumer Electronics Control. It allows sending commands via HDMI (High-Definition Multimedia Interface) from your VIDEO (Visual Ideas Directed Except Oldskool) card to the TV (Television).

However, virtually no video cards support this natively. The notable exception is the graphics card in the Raspberry Pi (RPI).

Fortunately, Pulse-Eight sells CEC injectors. It a tiny thing you put in between your computer and your TV. And today it arrived:

Very small and cute.

It’s a bit more extensive with the wiring. The product page said that you can’t use it reliably if you have a very long HDMI cable to your TV, but mine is seven meters, and it seems to work fine…  Oh, perhaps I should try playing something that takes a lot of bandwidth…  Let’s see…  Captain America: Civil War Bluray…  Yup, there’s the captain.  No extra latency or anything that as far as I can tell.

There’s a USB port that you communicate over. The device shows up as a serial device in Linux, and you talk to it via a program called cec-client.

This excellent blog posts details how you use cec-client from Linux, but basically you just say

$ echo 'standby 0' | cec-client -s /dev/ttyACM0

and the TV goes to standby mode.

OR DOES IT?

Mine didn’t, and it’s a five year old Samsung TV. After googling a bit more, it turns out that you have to enable this stuff under the “Anynet+” setting in the menus. Let’s just walk through this quickly, if anybody has problems finding the menu (which is something I had):

It’s way down in the main menu. Enter the “Content View” thing…

… and then choose “Anynet+”…

… and setup..

… and the thing you’re looking for is “Auto Turn Off”. If that’s on, then you can put the TV into standby mode via CEC. Makes sense, huh? HUH?!

So now all the bits are in place, and I can use this stuff. I chose to have xscreensaver wake the screen up with a -watch script modeled after this one.

So when I hit something on the TV machine keyboard, it unblanks xscreensaver and turns the TV on. (This takes an annoyingly long time, though… like 10 seconds? What’s up with TV makers and the incredible slowness involved with anything?)

To switch the TV off, I just hooked it up into my general go out/switch off everything before going to sleep actions.

Emacs is for automation.

There you go.

Blackest Night

Previously: I bought an HDMI OLED screen and determined that its black pixels emitted light.

This made me start wondering: Do all OLED screens emit light from “black” pixels?

So I did the simplest thing possible to test this: I made a little app that displays a black screen. It’s on Google Play and everything. It’s called “Blacker Than Black” if you just want to search for it on your phone.

So I loaded it up on my Blackberry Priv AMOLED (that’s short for “armored led”, I think), and went into the unmentionable room, and took a picture:

OK, that’s kinda… black… let me twiddle the camera settings… er… f2.8… ISO6400… two second exposure…

That’s still very black! Although now the camera can see my fingers in the very, very dim room. Very dim.

OK, let’s test another phone. That’s a Samsung Galaxy S6…  (Which is also AMMO LED.) Very black indeed.

OK, I’m convinced. That SmallHD AC7 OLED screen sucks, but other black OLED screens are blacker than very black.

For kicks, I loaded the app onto my Sony Xperia z4 tablet, which has an IPS screen. And dialed the exposure settings waaaay down.

Yeah. It’s not very black.

Galaxy S6 in front to compare.

So there you have it: The OLED blackness myth… IS CONFIRMED!

Shocking. But that just means that I have to find a different 7″ OLED screen from somebody that makes a better screen, and things will be perfect!

Unfortunately, after googling for an hour or two, that doesn’t seem to exist. There are other OLED screens, and a couple of them even have HDMI, but they’re all really, really ugly, and isn’t really something that I want in my bedroom.

Oh, well. I’ll have to wait a few more years for perfection…

Blacker than Black? A Small Monitor Review

I’ve been using an Emacs-based alarm clock for almost a decade through various hardware incarnations.

The main issue is the screen: It’s difficult to find a small screen that has a good black level. The last version used this USB IPS screen from MIMO, and it’s just about as good as you can get with IPS.

It’s difficult to illustrate just how it looks since the camera helpfully adjusts everything, but with the camera on manual, I think this is just about right when it’s darkish in the bedroom. When it’s completely dark, its glare is rather annoying.

So! I got an OLED screen today, because OLED has perfectly black blackness, right?

Quotes like “Produces True Blacks” and “Because OLED displays are not backlit like LCDs but rather lit by each individual pixel, black means black. This yields a contrast ratio of infinity to one.” can’t lie, can they?

And everybody knows that an OLED pixel that’s off doesn’t emit any light, right?

That is, indeed, quite black. But is it completely black?

No. If you look closely, it’s trivial to see where the black bezel ends and where the screen, filled with black pixels, starts. (The picture above exaggerates the issue a bit, depending on your monitor.)

But here we compare the IPS screen (to the right) with the OLED screen (to the left) in a completely dark room. The difference is huge. YUGE! But it’s not perfect!

The myth of total blackness in black OLED pixels: Busted.

SO DISAPPOINT!

Oh, well. This is approximately what this screen looks like from my vantage point in the bed when I’ll be waking up in the middle of the night and wondering what time it is before going back to sleep again, cursing the monitor gods and waiting for the next hardware revolution.

Sad!