Embedding a video in a "frame"

Forum: LinuxTotal Replies: 4
Author Content
techiem2

Jun 03, 2008
10:12 AM EDT
Ok, the digital sign is coming along nicely (I really need to update my wiki page on it). All the basic features work. I'm mainly now tweaking it to how we want it while keeping it easily configurable (hooray for configuration variables!) and trying to add features my boss comes up with. :)

So, we have a laptop hooked up to a nice 32" 1280x1024 LCD TV. Of course, a video from a DVD is 720x480, and you can't blow that up too much without noticeable artifacting and such. So what we are wondering is, is there a way to process the video and embed it in a "frame" image? We have a nice 1280x1024 template image that we are using for static screens, and we would like to turn that into a frame for videos too. Our Move Making program teacher says he can do it of course on his Macs, but it would be nice to be able to automate it on the sign box as well so someone can just upload a video and have it get processed and framed.

Thanks as always!

This project has been great fun and a good learning experience. I'm making sure that when my boss asks me to change how something is processed, that I make it a configurable option in the scripts to keep things as versatile as possible.

Mark II
Sander_Marechal

Jun 03, 2008
11:13 AM EDT
What's the back-end again? A standard video player? Something you wrote? It can be done fairly easily using gstreamer from the gst-launch tool by adding the image as an overlay. It's probably also possible using the ffmpeg suite.

Also, I don't know how you feel about Mono, but using Cheese may be an option. It has quite a few fancy effects.
techiem2

Jun 03, 2008
11:51 AM EDT
The backend is mplayer running in slave mode being controlled by php. The actual image and video processing is done via a perl script (called from the php page) that uses ffmpeg/mencoder/whatever to do what we want to the video/image. So basically we need something that can run cli to process the video into a frame from an image.
Sander_Marechal

Jun 03, 2008
12:40 PM EDT
Looking at this ffmpeg hook source file (http://www.irisa.fr/texmex/people/dufouil/ffmpegdoxy/imlib2_...) it looks like you can use the imlib hook not just for text, but also for image overlays.

So, open the video in ffmpeg, add padding to put a black border around the video and make it 1280x1024 using the padding options (http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html#TOC9), then use imlib to put a 1280x1024 overlay on the video. The overlay image should have a 720x480 transparent hole in the middle.

That should do it :-)
techiem2

Jun 03, 2008
2:08 PM EDT
Thanks! Just what I needed!

Here's my command lines:

Quoting: ffmpeg -sameq -i VTS_01_1.VOB -padleft 280 -padright 280 -padtop 272 -padbottom 272 tmp.mpg ffmpeg -sameq -i tmp.mpg -vhook "/usr/lib/vhook/imlib2.so -i border.png" test.mpg


Now we just need to figure out what kind of resizing we can do to the video without killing our a/v sync and quality too much and get a new template made with the proper size "hole" in it.

You cannot post until you login.