Tips, tricks and traps

Tips

Get the latest tips on the latest geeky things going on in the world

Learn more

Tricks

Once you find something there's always a trick or two that will make you even more productive

Learn more

Traps

Traps and gotchas that will make it hard for you, so why not read on and avoid them?

Learn more

Black Friday for Geeks

Black Friday for Geeks

So what’s a geek to do but drool over the Black Friday discounts and beyond. But as with all things technical, it pays a little to wonder if it is time to buy or whether you should wait for the next product cycle. Here’s a quick low down on popular (for nerds) holiday items:

  1. A new PC? Yellow Light. Well, that’s a good question and the answer is that if you can wait, you will probably like the upcoming Broadwell chips better. That being said, Intel is adding about 5-10% to desktop performance, so it isn’t a bad time. Haswell is pretty decent and they have just refreshed the line in the summer. The main complexity is that Intel has so many gradations, you need a slide rule to figure out a good deal (which I haven’t done). Still if you want save 10% off a processor, it’s not a bad time to buy.

  2. A new monitor? Red light. This is a time of major transition. The 4K displays are just out (8MP of glory), but the next round is even more amazing. Dell and Apple have just shipped 5K displays (15 megapixels if you can imagine that) and these are going to ship next year. So wait if you want. A related issues is that DisplayPort 1.3 is just coming out in early 2015 and you need it to drive these 4K monitors at more than 30 hertz. If you are a gamers of course, I can’t imagine how much power a 15 megapixel monitor is going to take. Remember still amazing Hd monitors (1920×1080) are just 2 megapixels! That being said if you need a monitor now, the ASUS PB27Q isn’t a bad office monitor (2550 for $480) and the Benq PT3000 ($600 on sale now at Newegg) is astonishingly beautiful as a 32” monitor.

  3. A new phone? Green light. Well as usual Apple is managing the cycles well so the new iPhone 6 Plus (drool, drool) is not a bad buy right now and you are at the top of the cycle. The main reason to wait would be the rumored dual camera setup in the upcoming iPhone models, but the camera (and the battery) in the iPhone 6 are pretty amazing.

  4. A new camera? Red light. Well, the new announcements are coming so fast and the improvements are just incredible. The main thing to wait for is 4K video recording which is becoming standard and Sony is rumored to be announcing a 50Mp full frame pro camera very shortly. That could be the turning point for prosumers ;-0 Also, GoPro is just switching to 4k, so you probably want to wait to see all the 4k offerings as video is a new battleground for cameras.

  5. More storage? Yellow light. You can never have enough disk and SSDs are really amazing right now. While it isn’t a bad time, if you can you should wait. The new Intel DC P3500 is not quite shipping, but promises incredible performance in the new NVMe format. Five time less latency for you geeks and pricing is decent $600 for 512GB. If you can’t wait, the new Samsung 850 Pro uses a vertical NAND technology and isn’t bad. It’s a premium part at $320 for 512GB (wait did I just say that, I can’t believe how prices have come down).

Cooler Gotchas

http_www_modifiedcarforums_com_blogentries_2008__featurecars_bigv8_images_bigv8blownstatesman_15_cms44f

We’ve been building lots of machines lately and it seems like we have struck out twice. Both times with cooler issues and once with a lack of an SSD:

  • We got the nice case and it says there is 65mm of clearance, the problem is the (??!!) people who designed it put the Ac power right next to the cooler, so with a big cooler like the Shrunken B is too wide for it. We could mod the case and move it, but probably better to get a less efficient but 34mm tall cooler like the Noctua instead. So be warned this case is nice, but with the AC where it is the clearance is 65mm over the top but won’t work for a 120mm fan on top. So instead we got the Noctua NH-L12 which is less efficient but shorter

  • We also got a file server case and Supermicro motherboard. The problem is that it uses the relatively unusual narrow ILM. The normal cooler uses a square interlocking module, but because this has 8 DRAM slots and 7 PCI Express, it uses the narrow ILM. So the Prolimatech Genesis won’t fit. But the good news is Noctua which I’ve used for small builds and for big does have a version the NH-U12DX i4 and NH-U9DX i4 and the NH-U12 is well rated by silentpcreview.com so a good choice at about $65 at Amazon.com

Regin: Top tier espionage

http_www_symantec_com_connect_sites_default_files_users_user-1013431_fig1-architecture_udjmbm

Vlad told me about this and it is indeed scary what Symantec has discovered. A super sophisticated hacking tool with five layers and great ability to hide itself when it detects anti-virus programs:

 An advanced piece of malware, known as Regin, has been used in systematic spying campaigns against a range of international targets since at least 2008. A back door-type Trojan, Regin is a complex piece of malware whose structure displays a degree of technical competence rarely seen. Customizable with an extensive range of capabilities depending on the target, it provides its controllers with a powerful framework for mass surveillance and has been used in spying operations against government organizations, infrastructure operators, businesses, researchers, and private individuals.

It is likely that its development took months, if not years, to complete and its authors have gone to great lengths to cover its tracks. Its capabilities and the level of resources behind Regin indicate that it is one of the main cyberespionage tools used by a nation state.

Grokking Snowmix

http_createdigitalmotion_com_files_2012_10_snowmix_lz38ro

This is another amazing tool that complements gstreamer. It lets you mix audio and video feeds quickly and easily and most importantly dynamically without having to write programs.

Here are some notes from the wiki, the discussion group there,  but mainly by looking at the sample snowmix ini files in the Snowmix/ini directory:

  1. This doesn’t have a git repository, so there is no easy way to see what has changed from version to version or see , who is doing the editing. It’s probably easiest just to suck it into your own github repository just for your own sanity. That is pretty easy to do. Create it on github.com and then git clone the empty one down. Then extract the tarball into it. Commit that and you have something with version control.
  2. The setup is with bootstrap (no relation to the Twitter invention). It is an interactive script so not well suited to installing with other modules. An easy addition is to silence all the read commands with a option flag if you really need it to be quiet. strapboot is the equivalent of make clean and blows it all away. Personally I’ve always liked buildall.sh and cleanall.sh but that’s a nit.

  3. The thing cooperates with gstreamer via shared memory pipes so you have to start snowmix first and then start gstreamer for input and then another gstreamer for output. Basically, you can set it up to read from a file input or from a shared memory pipe. It’s output is another shared memory pipe.

  4. This program likes to lives in it’s own directory. It is quite node-like in that this way. Even the binary runs inside the current working directory. Each program needs the shell variable SM set to that directory.

  5. There are a host of configurations that you feed it at the beginning via the single command line ini file. However, you can also dynamically talk to it and configure it via a port (by default 127.0.01 port 9999) which it listens to for plain text commands. For instance nc 127.0.0.1 9999 <<<“feed list” gives you a list of feeds in the system. Pretty cool.

Syntax of Snowmix commands

It’s a little hard to sort through the documentation, but the wiki looks like the main source and Peter (the developer) is active on the SourceForge discussions. But here’s a quick guide for programmers:

  1. There are no variables in the language, so every object just has an object id (typically starting from 1).
  • The arguments that are passed are completely positional. This means that you need a big of decoder ring as some things take 8 arguments (x, y, step x, step y) and it is like reading a shell script argument list

  • The interactive and programming language are the same. It is all run time interpreted which is nice and flexible.

  • Data Types

    1. Feeds. These are the basic video feed element. They are hard wired by a feed socket command so you can change feeds and their sockets much. By default there are 12 feeds supported but you can recompile and change this. They can be moved with feed shift and scaled with feed scale which is set it to n/d the size. This convenient when you want it to fit in say a smaller windows like 120/96. There is a stack command that gives the z ordering of the feeds. Note that you cannot rotate or move or change the feed socket, so this is the basic primitive.

    2. Text. These are primitives referred to by id numbers


    text string 1 Hello Hello World

    You can delete a string by leaving the final argument blank so text string 1 by itself is delete. Text strings also have some substitution variables.

    How you set this is a little complicated because text unlike feeds isn’t dynamic, so you basically have to run it in a command macro that runs on every frame. There is a magic command overlay finish ShowText that says after the overlays are done run me and this is the thing that does text placement. So we need to understand the execution environment but you can change text with commands and also by changing them through the control console. We will show this later, but this works so that you can use shell script to control snowmix


    #!/bin/bash while true; do # Change a string nc 127.0.0.1 9999 <<<“text string 1 Changed to Good Bye!!" # Create a place id 1 for text string 2 using font 3 and put it at at x=200, y=300 nc 127.0.0.1 9999 <<<“text place 1 2 3   200 300" sleep 10 nc 127.0.0.1 9999 <<<“text string 1 Say Hello Again" od
    1. Images. These are also first class object. The main thing is that you should use .png images as these have an alpha channel so that you can have logos without white backgrounds.

    Higher level objects

    1. Virtual Feeds. For some reason this isn’t in the current wiki documentation. Perhaps because shape feeds are more powerful (see below) are more powerful. They are better than feeds but have less flexbility than shapes. However the discussion has an ini file that explains how it works. As a small trap, virtual feeds only work if you define some text, so make sure to do that. After you define a feed,


    # virtual feed add virtual feed add 1 this is virtual feed number 1 # virtual feed source feed virtual feed source feed 1 1 # the place thing is massive with location x,y and the size w,h and then the source location so you can do a cut out, then the rotation you apply and how you scale it and then the alpha blending (1.0 is solid, 0 is nothing there). # virtual feed place rect # this says for virtual feed 1, put it at the upper left (0,0) and it is 1280x800. The source to get it from is at 0,0 with 0 rotation and scale it by ? on each dimension and set the alpha at 1 virtual feed place rect 1 0 0 1280 800 0 0 0.0 0.3333 0.3333 1.0

    There are some other commands as well for virtual feeds including:

    # This gradually fades virtual feed 1 to 0.04
    virtual feed move alpha 1 -0.04 25
    # this move the feed to x, y
    virtual feed move cord 250 100
    
    1. Shapes and Cairo. Built at the highest levels are arbitrary shapes that the 2-d graphics library Cairo can alter. Here is where you get lots of control of images. There isn’t much documentation here, so you basically have to try to map the Snowmix command to the Cairo primitive. The most important thing is that with shape feed you can bind a feed directly to a shape for really complex manipulates. The same is true for other primitives via shape text and shape image. You can create arbitrary shapes as well by giving it paths so
    shape add 1 Arc Ewith a stroke at the end
    shape arc_cw 1 0.0 0.5 0.1 3PI/12
    shape close path 1
    
    

    Then once you have a shape you can fill it, so this says put a stroke or line around it

    shape stroke 1
    

    You can then move shapes around the screen with shape place commands

    Command macros and TCL

    There are two programming languages in the snowmix. A homegrown macro language and a TCL interpreter which runs the way that Javascript runs with HTML.

    1. The basic command language has a command create and ending in command end and is invoked with just “ at the beginning of a line. It is a basic macro language and can call other macros. There is some limited conditionals based on the feed state (suspended or not), but there are no variables, return codes etc. The main concept is that it will run each frame and when you are done you can call next 10 and it will skip the next 10 frames and at the end you call loop to start over.
  • The biggest issue with the language is that it is highly stateful. The opposite of say node.js. Everytime you run a macro, it will execute differently. It uses a next which means after you get there, the next execution starts after the next and in effect skips the previous block. Also when you get to the end of command, it won’t start executing again unless you have a loop.


  • command create several_things_at_once # This line will only run once text place 1 0 0 # This says for the next 24 times you call this, run here next 24 text place 2 0 0 next 24 text place 3 0 0 # if you don’t have the loop, then after 1+24+24 calls it will do nothing loop command end
    1. These macros get called in two ways. First is that from the command console or from the port, then it will run async. But the main execution loop is started by two commands, overlay finish <command /> so that means it will that command on ever

    2. The same macro language can also be used dynamically. If you plug into the control port, you can execute a macro just by typing it’s name in.

    3. The macro language can also call out to TCL by a prefaced tcl eval so it can do some math.

    4. There seems to be a stack of commands as well found in one of the ini files where lines of macros are taken off and on.

    command pop Show
    command push Show text place 3 23 43
    

    The system runs at a high frame rate, so it is all about keeping up with that. That means the command macros are run


    command create ShowText # put text object 1, 2 through 7 on the screen text overlay 1 2..7 command end overlay finish ShowText

    In order to change things, you can not just have a new command running, but instead, you have to do an in place edit of command macros (yikes, that sounds dangerous), so this will have to do this on the command interface. This seems to be the basic way to get into the execution loop, so if you have run in the ini file, overlay finish Show


    # This deletes line 1 of the Show macro so it is in the main execution loop command deleteline Show 1 # This adds a line 1 which shows all the text command addaline Show 1 text overlay all

    Using TCL

    Before 0.4.4, you used TCL in one of two ways:

    • From within a command language, you can evaluate any TCL command with eval tcl
  • You can write a tcl routine with command create <command />.tcl and have it return a string with a \n which gets pushed into the interpreters. This allows you to run static commands, but not things that are procedural so you get around this by not using next which only works in macros, but by using at +<time> <command /> which is the same as the next if you think about it but without the looping.

  • With 0.4.4, this got extended so that instead of this long return string, you can just issue snowmix commands with snowmix parse <command /> directly in TCL making it more straightforward. And you can access snowmix variables with set a [snowmix info text string 1] which would give you all the attributes of a text string. You can then change things and push it out again withsnowmix  parse` and substitute tcl variables.

    1. maxplaces. This sets the limits for various objects. Obviously, smaller means higher performance:
    # Change default settings for maxplaces BEFORE any of the shape, text etc. commands. This sets the maximum id number you can have in the system and probably the amount of memory
    
    

    maxplaces shapes 170
    maxplaces shapeplaces 128
    maxplaces strings 180
    maxplaces texts 180


    3. If you want you can use the tcl way instead of the macro way of setting things and is probably a little bit more readable.

    Load TCL libraries

    include ../slib/system.slib
    include ../slib/basic-shapes.slib
    message SYSTEM LOADED
    include ../slib/scenes.slib
    message SCENES LOADED
    include ../slib/feeds.slib
    message FEEDS LOADED
    include ../slib/images.slib
    message IMAGES LOADED
    include ../slib/clocks2.slib
    include ../slib/texts.slib
    message Snowmix Libraries Loaded
    tcl eval FeedCreate “Feed #1″ 1 1280 720 /tmp/feed1-control-pipe
    tcl eval FeedCreate “Feed #2″ 2 1280 720 /tmp/feed2-control-pipe
    tcl eval FeedCreate “Feed #3″ 3 704 576 /tmp/feed3-control-pipe
    tcl eval FeedPAR 3 12 11
    tcl eval FeedDeadImage 1 100 ../frames/dead-1280×720.bgra
    “`

    Debugging

    There are few ways to do debugging that isn’t clear from the documentation, but thanks to a note from Peter, here is how it works:

    1. If you are out of the overlay loop then you can use the command message which pushes to the standard output or messagef which includes the frame number. This doesn’t run while it is in the main loop as this would flood the system
  • If you are in main loop, then you can still generate messages by escaping to out with tcl with tcl eval puts “the string name”

  • And to debug the entire system, the easiest thing to do is to run the command outside of the overlay pre or post loop and keep trying it.

  • Snowmix will core dump if you Ctrl-C too much and the shared memory is not correctly deleted, you can see how much is available as the shared memory with df  /run/shm and you can get rid of shared memory with rm /run/shm/shm*

  • CVideoOutput out of chm buffers. This is because the output side can’t keep up with what Snowmix is emitting as described below, so you it’s a good idea to use the included scripts until you figure out your own. In my case I tried to modify the output2screen and didn’t do it well ;-)

  •  When Snowmix runs out of shared memory for outputting frames, it will print the message CVideoOutput out of cshm buffers. and it will suspend outputting more frames until at least half of the configured shm buffers are available again.
    It is very important that the script that reads mixed frames from Snowmix runs flawlessly and have sufficient CPU and memory bandwidth availble.When Snowmix runs out of shared memory for outputting frames, it will print the message CVideoOutput out of cshm buffers. and it will suspend outputting more frames until at least half of the configured shm buffers are available again.

    It is very important that the script that reads mixed frames from Snowmix runs flawlessly and have sufficient CPU and memory bandwidth availble.

    Overlays

    This is perhaps one of the most confusing parts of the product and isn’t documented much but basically, you have to overlay things:

    • Overlays happen in order. The normal thing is stack 0 which is the lowest layer and then it is block.
    • For real feeds, the order is left to right with the right most at highest priority `stack 0 1 2 3 4 5 6 7 8 9’ means 9 is the highest.

    • The overlay commands are processed in the overlay loop

    Scenes

    Quite a lot of snowmix is about changing the screen layout. It is pretty laborious as you have to use macros. There is a new scenes system that makes it easier to switch and is much higher level that command macros but there seem to be very few examples of this.

    Grilled Opah

    http_domesticesq_com_wp-content_gallery_opah_opa-2-of-2_wexob1

    Well it’s also called Hawaiian moon fish, but it’s apparently more sustainably caught than tuna. We tried this Food & Wine recipe and was really surprised how tasty the fish is. The main thing is not the sauce but  a little salt and quite a bit of oil to keep it from sticking to the grill.

    These recipes never say, but it’s nice to get a bigger piece of fillet so that you can use an instant read thermometer on it. For salmon we like it rare at about 130F. This fish seems about the same. 125F off the grill leaves it slightly pink on the inside. 130F would have been perfect.

    too cool f15 strike eagle low level

    F-15_Strike_Eagle_Coverart

    Wow, Jalopnik found a GoPro dream. A low level flight through the mountains of Washington in an F15E Strike Eagle. I can remember spending hours in a simulator of that jet flying around looking for targets.

    Grokking Gstreamer

    http_gstreamer_freedesktop_org_data_images_artwork_gstreamer-logo-75_zekclj

    Well as I’m kind of someone who is knows how to use Play Doh trying to build the Empire State Building, but in a week or so of hacking and understanding Gstreamer. Here are some of the conclusions:

    1. Wow, this thing really has no documentation. There is a huge command reference manual, but really the tutorial that covers how the thing works and is structured isn’t there.
    2. The main things to understand are that it is a tool for testing, but in fact used for lots of scripting, so it pays to learn it.
    3. It is fundamentally about a pipe, so everything has a source and a sink. The simplest possible pipe looks like a command line where ! is used to represent the idea of a pipe |
    4. Note that you launch it with an included version number. gst-launch-0.10 are very old, you want at least 1.0. The stable version is 1.2, but 1.4 has openGL acceleration but is very new
    gst-launch-1.0 fakesrc ! fakesink
    
    1. There are many common places to get things and each filter can take a bunch of parameters. It is nearly impossible to figure out what the parameters are, so you have to look through, but in general a parameter looks like
    gst-launch-1.0 filesrc location=/home/rich/videos/launch.mp4 ! fakesink
    

    That is, it is parameter=value syntax. One of the strange things is that gstreamer allows casting of values and it in fact tries to figure out values. So you will see lots of code this is trying to get parentheses through bash:

    gst-launch-1.0 filesrc location=(string)/home/rich/videos/launch.mp4 ! fakesink
    

    Or people manage the quoting to make this work. The big problem here of course is that with bash variables, everything they are evaluated, you lose a level of quoting so you can just assign the string above to variable. Most of time, you don’t need to worry about this and just assume gat-launch will guess properly.

    1. The thing has thousands of filters, but there are some special ones that are like the universal pocket protectors of the gstreamer world, so the following one liner plays just about everything:
    gst-launch-1.0 filesrc location=/home/rich/videos/launch.mp4 ! decodebin ! autovideosink
    

    Here are some of the most useful
    – decodebin. This looks at the input and just does decoding
    – videoconvert. This takes any video format on the input and converts it to what the downstream folks want.
    – videoscale. Same idea with dimentsions
    – playbin. This is thing breaks the rule, it is both a source and sync and will play to the active output.
    – autovideosink. This figures out how to display to your screen
    – filesrc. Reads from your file system
    – fakesink. This is most useful for debugging, when you ask it to dump output as text with fakesink dump=

    1. Debugging this stuff is really hard. They have 5 levels of logging and you can set each chain in the pipeline with different debugging. This normally suffices as parameters where you have 3 which means print warnings, -v for verbose and -e means that when you Ctrl-C it, gstreamer will attempt to gracefully end the output.
    gstlaunch-1.0 —gst-debug-level 3 -v -e fakesrc ! fakesink
    
    1. Gstreamer will go on forever, this isn’t a problem when the source is a file, but what if you are just testing, the num-buffers=100 is very useful. You say you want to see 100 and then the pipeline ends.
    # This will eventually end
    gst-launch-1.0 fakesrc num-buffers=100 ! fakesink
    
    1. Capabilities. There is one filter which really looks weird syntactically, basically, gstreamer sometimes can’t guess what a stream is, so you have to give it a hint with something called a get capability. This is a comma delimited thing that looks like a pipe element but is really a list. So for instance, something coming out of a shared memory pipe might be raw bits with no header information and it might go out the same way, so you need capabilities and then do the right conversion and scaling. The format is a 4CC standard four character descriptor of the byte format so AGBR means alpha, green, blue and then red bits
    gst-launch-1.0 -e -v shmsrc pipe=/tmp/input-pipe ! video/x-raw, width=1920, height=1080, format=AGBR
    ! videoconvert ! videoscale
    ! video/x-raw, width=192, height=108, format=RGB ! shmsink pipe=/tmp/output-pipe
    
    1. A simple pipe isn’t very flexible, so you can actually set up an arbitrarily complex graph with tee (a la unix) to let muliple pipes see the same input and also merging so an element can see multiple pipes as input. The syntax is pretty confusing, so the best thing to do is to use new lines as much as you can like. Also note that you can name things for clarity.

    The syntax to indicate a tee is that one leg continues on while there is a space indicating the end of a pipe and then you get a line in essence for every new tee.

    gst-launch-1.0 fakesrc ! tee name=hello-dolly ! fakesink name=first-fake
    hello-dolly. ! fakesink name=second-fake
    hello-dolly. ! fakesink name=third-fake
    

    Title

    Grokking Gstreamer Grokking Gstreamer
    Content

    Well as I’m kind of someone who is knows how to use Play Doh trying to build the Empire State Building, but in a week or so of hacking and understanding Gstreamer. Here are some of the conclusions: Well as I’m kind of someone who is knows how to use Play Doh trying to build the Empire State Building, but in a week or so of hacking and understanding Gstreamer. Here are some of the conclusions:

    1. Wow, this thing really has no documentation. There is a huge command reference manual, but really the tutorial that covers how the thing works and is structured isn’t there.
    2. Wow, this thing really has no documentation. There is a huge command reference manual, but really the tutorial that covers how the thing works and is structured isn’t there.
    3. The main things to understand are that it is a tool for testing, but in fact used for lots of scripting, so it pays to learn it.
    4. The main things to understand are that it is a tool for testing, but in fact used for lots of scripting, so it pays to learn it.
    5. It is fundamentally about a pipe, so everything has a source and a sink. The simplest possible pipe looks like a command line where ! is used to represent the idea of a pipe |
    6. It is fundamentally about a pipe, so everything has a source and a sink. The simplest possible pipe looks like a command line where ! is used to represent the idea of a pipe |
    7. Note that you launch it with an included version number. gst-launch-0.10 are very old, you want at least 1.0. The stable version is 1.2, but 1.4 has openGL acceleration but is very new
    8. Note that you launch it with an included version number. gst-launch-0.10 are very old, you want at least 1.0. The stable version is 1.2, but 1.4 has openGL acceleration but is very new
    gst-launch-1.0 fakesrc ! fakesink
    gst-launch-1.0 fakesrc ! fakesink
    
    1. There are many common places to get things and each filter can take a bunch of parameters. It is nearly impossible to figure out what the parameters are, so you have to look through, but in general a parameter looks like
    2. There are many common places to get things and each filter can take a bunch of parameters. It is nearly impossible to figure out what the parameters are, so you have to look through, but in general a parameter looks like
    gst-launch-1.0 filesrc location=/home/rich/videos/launch.mp4 ! fakesink
    gst-launch-1.0 filesrc location=/home/rich/videos/launch.mp4 ! fakesink
    

    That is, it is parameter=value syntax. One of the strange things is that gstreamer allows casting of values and it in fact tries to figure out values. So you will see lots of code this is trying to get parentheses through bash: That is, it is parameter=value syntax. One of the strange things is that gstreamer allows casting of values and it in fact tries to figure out values. So you will see lots of code this is trying to get parentheses through bash:

    gst-launch-1.0 filesrc location=(string)/home/rich/videos/launch.mp4 ! fakesink
    gst-launch-1.0 filesrc location=(string)/home/rich/videos/launch.mp4 ! fakesink
    

    Or people manage the quoting to make this work. The big problem here of course is that with bash variables, everything they are evaluated, you lose a level of quoting so you can just assign the string above to variable. Most of time, you don’t need to worry about this and just assume gat-launch will guess properly. Or people manage the quoting to make this work. The big problem here of course is that with bash variables, everything they are evaluated, you lose a level of quoting so you can just assign the string above to variable. Most of time, you don’t need to worry about this and just assume gat-launch will guess properly.

    1. The thing has thousands of filters, but there are some special ones that are like the universal pocket protectors of the gstreamer world, so the following one liner plays just about everything:
    2. The thing has thousands of filters, but there are some special ones that are like the universal pocket protectors of the gstreamer world, so the following one liner plays just about everything:
    gst-launch-1.0 filesrc location=/home/rich/videos/launch.mp4 ! decodebin ! autovideosink
    gst-launch-1.0 filesrc location=/home/rich/videos/launch.mp4 ! decodebin ! autovideosink
    

    Here are some of the most useful Here are some of the most useful
    – decodebin. This looks at the input and just does decoding – decodebin. This looks at the input and just does decoding
    – videoconvert. This takes any video format on the input and converts it to what the downstream folks want. – videoconvert. This takes any video format on the input and converts it to what the downstream folks want.
    – videoscale. Same idea with dimentsions – videoscale. Same idea with dimentsions
    – playbin. This is thing breaks the rule, it is both a source and sync and will play to the active output. – playbin. This is thing breaks the rule, it is both a source and sync and will play to the active output.
    – autovideosink. This figures out how to display to your screen – autovideosink. This figures out how to display to your screen
    – filesrc. Reads from your file system – filesrc. Reads from your file system
    – fakesink. This is most useful for debugging, when you ask it to dump output as text with fakesink dump= – fakesink. This is most useful for debugging, when you ask it to dump output as text with fakesink dump=

    1. Debugging this stuff is really hard. They have 5 levels of logging and you can set each chain in the pipeline with different debugging. This normally suffices as parameters where you have 3 which means print warnings, -v for verbose and -e means that when you Ctrl-C it, gstreamer will attempt to gracefully end the output.
    2. Debugging this stuff is really hard. They have 5 levels of logging and you can set each chain in the pipeline with different debugging. This normally suffices as parameters where you have 3 which means print warnings, -v for verbose and -e means that when you Ctrl-C it, gstreamer will attempt to gracefully end the output.
    gstlaunch-1.0 —gst-debug-level 3 -v -e fakesrc ! fakesink
    gstlaunch-1.0 —gst-debug-level 3 -v -e fakesrc ! fakesink
    
    1. Gstreamer will go on forever, this isn’t a problem when the source is a file, but what if you are just testing, the num-buffers=100 is very useful. You say you want to see 100 and then the pipeline ends.
    2. Gstreamer will go on forever, this isn’t a problem when the source is a file, but what if you are just testing, the num-buffers=100 is very useful. You say you want to see 100 and then the pipeline ends.
    # This will eventually end
    # This will eventually end
    gst-launch-1.0 fakesrc num-buffers=100 ! fakesink       gst-launch-1.0 fakesrc num-buffers=100 ! fakesink
    
    1. Capabilities. There is one filter which really looks weird syntactically, basically, gstreamer sometimes can’t guess what a stream is, so you have to give it a hint with something called a get capability. This is a comma delimited thing that looks like a pipe element but is really a list. So for instance, something coming out of a shared memory pipe might be raw bits with no header information and it might go out the same way, so you need capabilities and then do the right conversion and scaling. The format is a 4CC standard four character descriptor of the byte format so AGBR means alpha, green, blue and then red bits
    2. Capabilities. There is one filter which really looks weird syntactically, basically, gstreamer sometimes can’t guess what a stream is, so you have to give it a hint with something called a get capability. This is a comma delimited thing that looks like a pipe element but is really a list. So for instance, something coming out of a shared memory pipe might be raw bits with no header information and it might go out the same way, so you need capabilities and then do the right conversion and scaling. The format is a 4CC standard four character descriptor of the byte format so AGBR means alpha, green, blue and then red bits
    gst-launch-1.0 -e -v shmsrc pipe=/tmp/input-pipe ! video/x-raw, width=1920, height=1080, format=AGBR
    gst-launch-1.0 -e -v shmsrc pipe=/tmp/input-pipe ! video/x-raw, width=1920, height=1080, format=AGBR 
    ! videoconvert ! videoscale 
        ! videoconvert ! videoscale ! videorate
    ! video/x-raw, width=192, height=108, format=RGB ! shmsink pipe=/tmp/output-pipe        ! video/x-raw, width=192, height=108, format=RGB ! shmsink pipe=/tmp/output-pipe
    
    1. A simple pipe isn’t very flexible, so you can actually set up an arbitrarily complex graph with tee (a la unix) to let muliple pipes see the same input and also merging so an element can see multiple pipes as input. The syntax is pretty confusing, so the best thing to do is to use new lines as much as you can like. Also note that you can name things for clarity.
    2. A simple pipe isn’t very flexible, so you can actually set up an arbitrarily complex graph with tee (a la unix) to let muliple pipes see the same input and also merging so an element can see multiple pipes as input. The syntax is pretty confusing, so the best thing to do is to use new lines as much as you can like. Also note that you can name things for clarity.

    The syntax to indicate a tee is that one leg continues on while there is a space indicating the end of a pipe and then you get a line in essence for every new tee.
    The syntax to indicate a tee is that one leg continues on while there is a space indicating the end of a pipe and then you get a line in essence for every new tee. As a convention, I like to use initial capitals to indicate names like this

    gst-launch-1.0 fakesrc ! tee name=hello-dolly ! fakesink name=first-fake
    gst-launch-1.0 fakesrc ! tee name=Tee-out ! fakesink name=First-fake
     hello-dolly. ! fakesink name=second-fake 
         Tee-out. ! fakesink name=Second-fake 
     hello-dolly. ! fakesink name=third-fake
         Tee-out. ! fakesink name=Third-fake
    
    1. Now there are multiplexer which can take multiple inputs. A classic mux is one that interleaves audio and video like say mastrokamux which takes audio and video and merges them. This is where naming helps. Basically, if you create a name, you can use that as the end of a pipe, so if you want to merge say 1 video and 2 audio feeds into an MKV file, it would look like And again, there are really three pipes here all separate by white space
    
    gst-launch-1.0 videotestsrc ! mastrokamux name=MkvMux 
             audiotestsrc ! MkvMux 
             audiotestsrc pattern=sine ! MkvMux
            
    1. So putting it all together for extra credit is an audio source from Linux Pulse audio system that tees itself and a video source for V4L2 linux device first encodes itself as X.264 and compensates for different video format (con. These then fee two mux which create difference file formats for MKV and for flash (FLV) simultaneously. What is happening is that we have four declarations of pipelines for the audio and video and then for the multiplexor. Note that we are using the `queue` super command because gstreamer is real time. Queues ensure that we don’t have dropped frames

    gst-launch-1.0 -e -v v4l2src ! videoconvert ! videorate ! x264enc ! tee name=VideoSrc pulsesrc ! ffenc-aac ! tee name=AudioSrc matrovskamux name=MkvSink ! filesink location=file.mkv flvmux name=FlvSink ! filesink location=file.flv VideoSrc. ! queue ! MkvSink. AudioSrc. ! queue ! MkvSink. VideoSrc. ! queue ! FlvSink. AudioSrc. ! queue ! FlvSink.

    This syntax I think is much clearer than the normal one although more wordy. Normally, you save a three lines because you continue the pipe onwards, so the below is equivalent, but I find it much more obscure when you look at it again because it isn’t very symmetric:

    gst-launch-1.0 -e -v
    
    v4l2src ! videoconvert ! videorate ! x264enc ! tee name=VideoSrc ! queue ! mastrovskamux name=MkvMux ! filesink location=file.mkv
    
    pulsesrc ! ffenc-aac ! tee name=AudioSrc ! queue ! flvmux name=FlvMux ! filesink location=file.flv
    
    VideoSrc. ! queue ! FlvMux.
    
    AudioSrc. ! queue ! MkvMux.
    
    

    Linux benchmarking

    http_static_nationalgeographic_nl_pictures_genjUserPhotoPicture_original_50_21_39_speed-23-392150_rrxykh

    Well now that we are trying new Linux machines from VMware Fusion to Zotac, it’s interesting to see how fast they really are. Phoronix seems like the top hit and their 4.x suite is available as a Debian repository

    sudo apt-get install phoronix-test-suite
    

    How easy is that. If you want their latest tests, then you do have to yank it from the network.

    They have a dizzying array of tests with phoronix-test-suite --list-tests and using it is decently simple. Go to openbenchmarking.org and find an interesting test name and then run the command

    phoronix-test-suite list-recommended-tests
    TESTNAME=povray
    phoronix-test-suite default-benchmark $TESTNAME
    

    Hardinfo is another simple and graphical benchmark tool

    Updates on Zotac CI540 Nano and SSDs for a silent $600 desktop

    http_content_hwigroup_net_images_products_xl_231907_4_zotac_zbox_ci540_nano_plus_ess4lm

    Well that Zotac box is sure nice at $370. It is only 1.5GHz, but ultra quiet and we paired it with a screamer drive (the SanDisk Extreme Pro for $299) and 8GB of Crucial SO-DIMM memory for $68. The only wish is that it would have 16GB or two slots worth. So a nice simple system $370+299+68=$700 and uber small. Probably comparable to a Mac Mini in terms of price and certainly high performance.

    But in looking at ordering some more, prices have come down:
    – Zotac from Rakuten has fallen from $360 to $340 including tax which is nice
    Tom’s Hardware just updated their SSD recommendations and we had gotten a very fast SSD, but the MX100 512GB is probably a better match at $209 from Newegg
    – Memory at Newegg is also down slightly with Ripsaws at $58 instead of $68.

    This brings the cost down quite a bit to $340+$209+58=$600 or so. If you don’t need 512GB, then the Crucial MX100 at $110 is quite a deal and you end up with a fast $500 system.

    Some configuration notes:
    1. Set up with Ubuntu 14.04 LTS. This works from the a USB or a SD on a USB adapter, but not from the SD reader itself.
    2. When you do the setup, only the wired lan adapter is detected with 14.04 LTS. However, when you install, the Intel wifi drivers are found and loaded, so you only need to be wired on initial setup.
    3. The thing really is very silent. Unlike the Atom processor’s we’ve used before, this low power Haswell is decently powerful driving the graphics for Xubuntu and is certainly absolutely quiet and pretty cool. The CPU runs at 67C which is pretty hot, but within thermal limits and the outside of the box gets luke warm. Probably 80 degrees or so at idle.

    Sudoers hacking

    Sudoers hacking

    If you are constantly have to type your password in due to a long installation (like a few hours), then here’s the trick. Add the following line with

     

    ““

    sudo visudo


      You should use visudo so that it checks your sudoers file and makes it work, but to exempt a user from ever having to type their password (a big hole unless you are running on VMware Fusion so the host operating system is providing security, you want to create a new file in /etc/sudoers.d so you don't pollute the base /etc/sudoer file. All files in the directory are included in the main sudoers file  

    what-ever-user-name-you-want-to-exempt ALL=(ALL) NOPASSWD:ALL


      If you want to be a little more safe just crank up the time between asking for passwords say to 5 hours (5 x 60 = 360). Note that the word Default must have initial caps:

    Defaults timestamp_timeout=360

    “`

     

     

    Follow me on Twitter

    Categories

    Archives