MPlayer cropped playback

Back in 2012, I was wondering if I could play a video using MPlayer, and cropping into a certain area — note that I wasn’t looking for a way to crop an area of a video as in re-encoding, but a playback method:

• crop playback using mplayer - 2012-08-08T04:56:38Z

For example, a frame from this video as shown below, you can see the most of the video is a terminal window with the calculator on top of it:

The focal point is that calculator, there might be a way to zoom in perfectly, but it took me two years and four months to finally get to find the solution.

Since I use MPlayer to play videos most of time, the answer lies in the filters -vf (formerly -vop), the crop filter is the one would do the trick:

Crops the given part of the image and discards the rest. Useful to remove black bands from widescreen movies.

In this case, the command would be — you can also use with -ss to skip to the main part, cropping and skipping might come together — like the following, nicely crop out the area of the calculator as you can see on the right:

% mplayer -vf crop=199:299:686:226 <video file>

It might be tricky when you are trying to find the correct size and position to crop out the area you want, that’s where the rectangle filter comes in to help out:

Draws a rectangle of the requested width and height at the specified coordinates over the image and prints current rectangle parameters to the console. This can be used to find optimal cropping parameters. If you bind the input.conf directive ‘change_rectangle‘ to keystrokes, you can move and resize the rectangle on the fly.

Note the last part about change_rectangle keybinding, though I haven’t yet to try it, it seems that would be even easier to help to define the area.

Using the command as follows, it draws a rectangular box to indicate the area, so one can slowly adjust until satisfied:

% mplayer -vf rectangle=100:200:700:200 <video file>

Beside these two, there is also a cropdetect to help determine the area:

Calculates necessary cropping parameters and prints the recommended parameters to stdout.

You will get messages like, using default values:

[CROP] Crop area: X: 0..1279  Y: 0..719  (-vf crop=1280:720:0:0).
A:  23.0 V:  22.8 A-V:  0.190 ct:  0.786   0/  0  2%  0%  0.2% 5 0
[CROP] Crop area: X: 0..1279  Y: 0..719  (-vf crop=1280:720:0:0).
A:  23.1 V:  23.0 A-V:  0.126 ct:  0.786   0/  0  2%  0%  0.2% 5 0

The suggested -vf doesn’t help for this video, it gives you a parameter virtually crop the entire video out, but that’s understandable, you probably need to be a human to decide properly what you want.

After all this time, I couldn’t even recall what the video triggered me having this thought. Anyway, now I know how to do it next time I need it.

The Temp Job: Past Christmas

“I’m your mother,” she claims.

The woman I have known for my entire life is whom I called by mother, even after I realized that I was adopted. In my heart, I wanted her to be an impostor, not my adoptive mother, but every instinct in me is telling me that she is my mother, and she has the ability to insert.

Kate is clinging to my arm, standing behind me, asking what is going on in whispers. She knows it’s serious, or I wouldn’t be risking exposing myself and calling in four Protectors while our family is all around for holiday. I can feel her trembling hand, she isn’t sure if that is our mother in front of us.

The woman is looking at us with confidence and a smile that could melt hearts, didn’t even flinch when four people appearing in strange dresses, while others slowly keep distances farther and farther away, leaving us in the living room.

Maintaining the smile as she begins to approach us, they block her immediately, she wouldn’t be able to reach us close and she is fully aware of that.

“Kate, do you remember what you said when you first saw Keith in the crib?” she asks.

I know what she is doing, but Kate isn’t answering her yet. She wants to get to Kate first, if she can’t physically get to us. If you can do insertions, you can find out the answer easily, so do have the right question to gain Kate’s trust.

“He looks like a little pea in a pod,” they say in unison with giggles.

No idea why I looked like a pea, I’d have to find out about that afterward, but I must be distracted more than I expected.

“It’s okay, hon,” she says.

Kate has reached out to take her hand, I am already too late to stop, they have hold hand in hand. I can see her hand that Kate is holding dearly.

“No, you can’t be,” I say.

The glowing green light shades underneath her wrist, from the activation of the bracelet. Our mother is an Inserter, one of us, that’s why I can sense her presence, though I haven’t figured out why only moments ago.

“Two hours before Christmas midnight, 1705, England,” she answers to our silent, yet to popped question.

It’s pitch black everywhere, but I know we are standing on a hill, or a place up high, because I can see dim and flickering lights around us. The ground is soft, covered in snow, the air is cold and chill. It’s dark and silent.

Three of us, alone, I can call in supports, but I want to know what this is about, why she brought us here, to this time period. She walks a few steps forward, looking for something.

“There, it’s about to start,” she points at one dark direction.

I can barely see anything, there are some houses, a few lights, but that’s all I can make out with my naked eyes. She is still standing in front of us, anticipating something to happen.

“How could you be my mother?” I ask.

She doesn’t answer, not even turning back to look at me, but we both know. Even though we are here for a reason, I need to ask for an answer that I don’t even need, or which wouldn’t change the fact. Kate doesn’t understand why I wanted to ask that question, not even that question actually meant to ask, but she knows that’s our mother.

“She isn’t just our mother, she really is my mother,” I say to Kate.

She finally understands, the thing clicks into her mind. Mom turns back to us, smile again before continuing.

“I was on a mission when I found out that I was pregnant with you. I couldn’t just come back with a big belly, so I did the best as I can, pretending someone dropped you on doorstep. Your father still doesn’t know you are his own blood,” she has confirmed that I have inferred.

Kate assures me that everything turns out great, but I really can’t be sure about anything. I thought I was adopted, then ended up being part of an organization. Out of blue, discovering my own mother is an Inserter, and now we are standing in a place, three centuries ago.

It doesn’t take long to know what she is waiting for. The light starts to grow bigger and brighter, then dogs bark, people start to shout, a fire has broken out, and turns into a giant fireball engulf the town below.

“You have to save her,” she points again.

It’s the nearest building, a window of upper floor, there is someone standing by an open window, seeking for help. This side has no accessible road, no one can see her but us.

“You know I can’t do that,” I respond.

We are not allowed to intervene unless for correcting the history. I don’t know who she is, or if she would survive the fire. She might, but by someone else, if I go in, history might be changed; she might not, then history definitely is altered.

As an Inserter, she knows the rules, but she says no more, just watching that girl calling desperately for help at that window. Kate urges me to do something.

“Damn it! Fuck!” I curse twice, first one for breaking the rule, second one for the coming danger in the room.

I jump forward as the flame like a living monster wanting to consume me, the room is blazing hot, everything is burning and crackling. This building wouldn’t last long. I can’t hear that girl crying for help, looking over, she is about to climb over the window. She wants to jump, but at this height, she might not stand a chance. Sitting on window frame, peeking down with scare.


She is about to flip over to the other side, hearing my voice and turn to look at me, joy at first, then a confusion shows on her face. It could be just she doesn’t recognize me, or someone wears clothes she has never seen. Either way, I rush to her, pull her into my arms.

“What? I, where?” she asks incoherently.

I have brought us back to the hill, where she can see the burning house which she was just sitting on window frame a moment ago, now on white snow, in a dark night out. She has no clues what just happened, still trying to make a sense.

“What are you doing?” I ask in awe.

My mother has taken off her bracelet and activated the emergency homing countdown — the same one that saved my life in that alley — she slaps it on the girl’s wrist, shrinking down, another surprise for the girl, she is trying hard to grab that bracelet to no avail, then a ring of red light glowing before she is transported.

“What the heck were you doing? You can’t just send anyone,” I ask again.

Almost like scolding other newly recruited Inserters, who can’t follow the strict regulations and rules.

“That’s you, isn’t it? Holy molly, mom, you are three hundred years old!” Kate comments in excitement as if she just discovered a vampire or some sort of undead creature.

Kate recognized the girl, who looked like photos from mom’s early photos, she can see some similarity. Our mother has more secrets than I thought I have learned enough. She was born in 1689, died at age of sixteen in a Christmas fire, body was never found.

“Let’s go back first, we don’t want to be seen. Christmas eve, 11:30, on roof. Yeah, I know, even I told you not to, you two still climb out to roof,” she says.

One hand on Kate’s, another on me, beckoning me by shaking my hand. I just forget the girl has the bracelet, and she wouldn’t be able to perform insertion anymore.

“Jesus Christ, I am too old for this! This is really the last time, no more roof!” she gasps almost fell off roof.

We help her sit down on the sloped roof, waiting her to calm down, catching her breath, and scolding her two kids for being risking their lives on a roof.

“So, what are you? I must be out for very long time, is there an detection upgrade in bracelet now?” she asks curiously.

“Keith is the Prime Inserter,” Kate proudly informs our mother about my position.

“Prime?” surprised, but doesn’t sound happy.

She looks at me, we still hold in hands, I can feel her hand squeezing mine. Mom turns to ask Kate what she is since Kate clearly is with me and aware of everything, trying to avoid questions from me.

“Just a tag along big sister,” Kate says heartily.

Mom laughs, but eventually she has to tell us why she felt sad. After the laughter die down, we all look at the sky in silence.

“On numbers, I am 325 years old, but we all know it’s much more than the number says. Do you have any idea how old the Director is? The more important you are, the less chance you can get out and still be alive and live to a natural death. I am happy, met your father, married, have a great family finally,” she says.

As Kate growing up, she knew Kate and her were the two women she met hundreds of years ago. She thought I was someone else, as I getting older, she knew I was the guy who pulled her out of fire and older her sent herself to a long journey.

She was like me, only she brought herself in, I was by someone else. Everyone in it has very limit personal life involving people outside since outsiders die inevitably, mostly have no relationship inside or outside. I don’t know how my parents met, but she must have received a special permission and treatment since she has appeared to age normally, at least in my eyes as I grew up.

“I knew this day would come, both of you would be involved, nothing I can do to stop it. Just I didn’t expect you are the Prime. Keith, you are more important than the Director,” she continues.

That speaks all her concern. I have never thought about the end, the tangling threads keep you away from those thoughts, I am just starting, still thrilling every time I went on something. If the age of the Director is such mystery, I can’t imagine how old I would be in the future.

“Take care of each other,” she says softly to us.

She knows we might be in it for very long time as her own experience speaks for itself, and this tag along sister might be getting herself into an extremely lengthy life.

Giving us some gentle petting on back of hands, reminding us to oversleep to miss unwrapping as we should before leaving us alone on the roof.

“Don’t even think about it. Again!” Kate warns me.

Gentoo emerge: the other white meat?

A few days ago, I was trying to see if emerge has a special command to show the number of installed, of in-world, and of in-system packages, so I ran:

% emerge --help
emerge: the other white meat ([snip])

In five months, I will be a Gentoo user of six years, but I’d never paid attention to the first line of the help message of emerge command.

I was wondering what does “the other white meat” means? I searched the internet, including the Gentoo Forums, nothing came out on that subject. So, I cloned Portage, and looked for an answer in commits, hoping they would shade a light with a clear message. I did find the commit that added the line, the message reads:

default --help should be usable, so make the extended output require --verbose

It was authored by Mike Frysinger on 2007-03-22. Two years before I started using Gentoo Linux, can’t argue it’s after so I didn’t read about it. The commit message doesn’t say anything about the “meat,” I hit a dead end.

I could just post a question on forums, or email Mike Frysinger, his email address is in commit. I might, but now I’d like to speculate what that line means.

Gentoo Linux’s mascot is Gentoo penguin, which lives around Antarctica, and penguin is birds, like chickens that we human consume. So, you can see which direction I am going.

Since chickens as we know are white meat, so Gentoo penguin is also white meat, that I believe. I don’t know for sure since I have never eaten any penguin meat, and not as if I’d like to.

I think “the other white meat” might mean that, but I could be terribly awfully wrong about everything. It might just some personal experience of the author had, and has nothing to do with the flesh or any penguin.

I might never know the answer, but I am okay with that, it’s just another interesting line and humor which I don’t know.

Apparently, some people did eat penguin.

Shade a light, or flap a wing?

Passing escape codes for changing font within tmux in urxvt

There is a couple of known font changing escape code for urxvt (rxvt-unicode):

printf '\e]710;%s\007' "$FONT"
printf '\e]50;%s\007' "$FONT"

I have been using it in my for three years, but I never could figure out how to make it work within tmux. I did search for an answer, but didn’t find any solution, probably wasn’t trying hard enough.

The solution is quite simple, you prepend \ePtmux;\e and append \e\\ around the escape codes. That’s it, and tmux would pass along without eating it, for instance:

printf '\ePtmux;\e\e]710;%s\007\e\\' "$FONT"

It’s more than three years and was released in tmux v1.5 (2011-07-09):

  • Support passing through escape sequences to the underlying terminal by using DCS with a “tmux;” prefix.

If I really need to change fonts, I would have to detach tmux, change the font, then finally reattach, quite a hassle. That’s why I don’t usually do it unless I have to.

Well, it’s better late than never.