- Posted by jfarrar on February 20, 2009
I had a project recently the required there to be a way to create a slideshow of photos automatically and output it to a video format (flv in this case). After extensively googling for existing command line tools I came up with a few results. One being FFmpeg and ffmpeg for windows. Another being On2 Flix Standard or Pro and more importantly the fact that they have an engine to do batch encoding. I'm sure there are more out there as well.
Anyhow, to create a very basic slideshow you could do the following from a command line prompt:
ffmpeg -f image2 -r .3 -b 180000 -i C:\photos\photo%d.jpg -i C:\ffm\bin\output\mix.wav C:\output\testvideo.flv
-f for the file format
-r stands for rate or FPS and means it should be .3 frames per second (roughly 4 seconds a photo)
-b is the bitrate (180kbps)
-i for inputs including photos and music
However, this leaves you wishing you could do some fancy transitions like most photo slideshow programs allow you to do. Is it even possible from the command line? You bet. It took me awhile to actually find a way to do this, but after a bit I found a solution. FFmpeg takes alot of different kinds of input. It additionally will take an AVS file for input. Which is a script based on the scripting program AviSynth.
So what is AviSynth? Basically it's a frameserver which means there is no user interface. After installing the latest version it will place a dll in your windows/system32 folder called avisynth.dll. It also registers it with the system. After registering it with the system you can write a script in notepad or any avs editor. Once written you can pass the avs file into FFmpeg as the input parameter and it will generate an FLV based on the file (ffmpeg -i sample.avs C:\output\photoslideshow.flv. This is because AviSynth is handling the processing of the file and sending actual avi data to ffmpeg.
Additionally, when writing the script take a look at TransAll which is a rather useful plugin for AviSynth that allows you to do mutiple transitions. Additionally, to prototype and see how fully blow avs scripts look like go download this program (foto2avi) and create a slideshow. Then open up C:\Program Files\Foto2Avi\Avs\Temp.avs and it will show you the script it made to create the video. Here is a rough sample:
SetMemoryMax(256)
Import ("..\Functions\Function.ShowImage.avs")
LoadPlugIn("..\Plugins\TransAll\TransAll.dll")
Import ("..\Functions\Function.BasicEffects.avs")
Import ("..\Functions\Function.PlayAudio.avs")
#####################VIDEO-PHOTOS#########################
s0=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Autumn Leaves.jpg",720,576,25,125,false,$000000,false,false).BasicEffects(0,$000000,50,$000000,false,0,"Flip Disabled",0,1,0,1,"Seppia Disabled",2,"Noise Disabled",0,0,0,0,false,true)
s1=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Creek.jpg",720,576,25,125,false,$000000,false,false)
s2=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Desert Landscape.jpg",720,576,25,125,false,$000000,false,false)
s3=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Dock.jpg",720,576,25,125,false,$000000,false,false)
s4=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Forest Flowers.jpg",720,576,25,125,false,$000000,false,false)
s5=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Forest.jpg",720,576,25,125,false,$000000,false,false)
s6=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Frangipani Flowers.jpg",720,576,25,125,false,$000000,false,false)
s7=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Garden.jpg",720,576,25,125,false,$000000,false,false)
s8=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Green Sea Turtle.jpg",720,576,25,125,false,$000000,false,false)
s9=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Humpback Whale.jpg",720,576,25,125,false,$000000,false,false)
s10=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Oryx Antelope.jpg",720,576,25,125,false,$000000,false,false)
s11=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Toco Toucan.jpg",720,576,25,125,false,$000000,false,false)
s12=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Tree.jpg",720,576,25,125,false,$000000,false,false)
s13=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Waterfall.jpg",720,576,25,125,false,$000000,false,false)
s14=ShowImage("C:\Users\Public\Pictures\Sample Pictures\Winter Leaves.jpg",720,576,25,125,false,$000000,false,false)
#####################SOUNDS#########################
a0=PlayAudio("C:\ffm\bin\output\mix.wav",0,4513,25)
#####################TRANSITIONS#########################
trans0=TransFlipPage(s0,s1,25,dir="left")
trans1=TransFlipPage(trans0,s2,25,dir="left")
trans2=TransWeave(trans1,s3,25,type="weave")
trans3=TransRipple(trans2,s4,25,lambda=40,amp=8)
trans4=TransVenetianBlinds(trans3,s5,25,type="cheq",width=40)
trans5=TransSwirl(trans4,s6,25,dir="clock",step=10)
trans6=TransPeel(trans5,s7,25,dir="up",rolldia=50,shade=127)
trans7=TransPaint(trans6,s8,25,type="paint")
trans8=TransAccord(trans7,s9,25,dir="vert",twin=true,open=true)
trans9=TransSlantWipe(trans8,s10,25,dir="se")
trans10=TransSlideIn(trans9,s11,25,dir="center")
trans11=TransWeave(trans10,s12,25,type="weave")
trans12=TransWipe(trans11,s13,25,dir="left")
trans13=TransShuffle(trans12,s14,25,dir="left")
#####################RETURN#########################
audio=MixAudio(trans13,a0, 0.5, 0.5)
return AudioDub(trans13.ConverttoYV12,audio)
Hopefully that helps you if you need to create a slideshow automatically and you have the photos on hand and you can generate the avs files at runtime. Additionally check out FLVMDI http://www.buraks.com/flvmdi/ which will allow you to inject metadata into the FLV after it's created. It will, among other things, give you the ability to make sure the duration is set properly in the FLV.
Feel free to leave some comments.
Joseph
0 comments
- Posted by jfarrar on October 11, 2008
Well this was my first trip to Broadsoft Connections and hopefully not my last. I had a really good time going down to AZ. We (my family, a friend and my two business partners) drove down last Sunday. It wasn't a bad trek from Las Vegas. Going about 80mph the whole way got us there in about 4 1/2 hours. We stayed at the Extended Stay Deluxe hotel. Funny pun about that, is that the Broadsoft show had a theme this year called "Xtend".
Once we got there we had to head over to the Westin to do a dry run through of our slot on "Show Me The Apps". Almost immediately we met up with Thomas Howe (who won first place in the Broadsoft Mashup Competition). This guy really gets it when it comes to voice mashups. Yeah, so his apps may not look all graphical and stuff, who cares, his stuff makes sense. Anyhow, it was refreshing to hear some of his stories over the three days of the conference. If you have a chance to meet up with him, do so, in fact you can in November if you are up near VoiceCon in San Francisco. On top of being a nice guy he has a wealth of information regarding the ip communications industry.
After doing the prep work on Sunday there was a welcome event. It was a good networking event. Saw some old faces and new during the event. Got to meet up with some people that we had talked to on the phone as well. It was overall a fun night, well that is until this one guy got pretty drunk and was leaning on everyone and stumbling around. He was trying to talk to us about why he sells PRI's and he wasn't making any sense. LOL It was pretty hilarious.
Monday started out good, didn't get much sleep because of preparing for Tuesday morning's session. I've spoke in front of people before, but I always get somewhat nervous. I guess it's a good thing. Unless I get distracted I'm able to tune out the nerves. Anyhow, spend most of Monday networking again, getting cards and meeting people. Dr. James Canton spoke regarding the future. He started out really strong, but ultimately got less interesting as time went on. He touched on so many things that are "trends" that it made it confusing to follow. Some of the points he made I know are true and I see being the future, but I think today we need something tangible as well.
I got this great idea on Monday that I should create an IVR app that would allow you to integrate Broadsoft's XSI Platform with VXML and CCXML. That night I spent about 2 - 4 hours putting together the app and testing and modifying code and testing etc. In the end at about 2:30am I finished the necessary coding to make it stable to run. With only 5 hours left till the session "Show Me The Apps" - I got a little rest.
Come 7:30am it was time to run through the demo's. We (Len and I) were in the slot to go right after Thomas Howe's demo. Thomas appears to have done this alot, he was straightforward and very informative. After running through the demo's it was about 8:15am (15 minutes till the start). Nerves started kicking in at this point. It was good though, because it kept my adrenaline going and my excitement up.
IMO the highlights of the demos (to start with) were Omar and Wendell from Broadsoft. They demoed some really cool apps. Two of them were Google Gadgets which allow you to view your call history as well as your voicemail history. Then they showed off an iPhone app that allows you to access into the Broadworks Anywhere service. After that they showed off a pretty cool provisioning tool that would streamline the process for creating enterprises, groups and users. On a side note, I've had my fair share of coding this of app before and it takes some time but is well worth it. Anyhow, that was there demo (really cool!).
Alex Danyluk from Microsoft and Alex Doyle from Broadsoft showed off the cool integration features of the Office Communication Server and Client to the audience. I've been doing work with OCS since it was LCS. Which I guess isn't that long (2003), but its come a long way. Mobile Max also showed off their integration into Broadsoft Anywhere with their Mobile Client Application. Some great integration on their platform, I was impressed. Best feature IMO, has to be the extension dialing from your cell phone!
Thomas Howe (no I don't get paid to say his name lol) delivered a great talk on voice mashups and demonstrated the app that won him first place "Disaster Dispatcher". Interesting concept and he completely explained his intention behind it. You can read more about that here. Overall I think his message was well received.
Made my nerves even worse haha. On top of that we were trying to log into our mobile portal on the blackberry we were borrowing. We were having some technical difficulties almost right up until we went on. Despite that everything went well and without a hitch once I started talking and Len started driving. Len is the CEO of BlueVisor btw, and I'm obviously JoeDeveloper, but one thing that we released while we were there is that I've joined on to be well Chief Of Apps if you will. JoeDeveloper will still continue on as it has, you will just start seeing more and more of BlueVisor.
It appears that people liked the apps overall and not just ours. My personal favorite was by the guys at WorldxChange in New Zealand. They had a very real solution to a very common business problem; debt collection. They took an app that existed and added voice into it. Adding voice by setting up a way to allow account reps to initiate automated calls to the customer letting them know that there balance is past due. They also had it in a bulk format where you could send multiple calls at once. While they are a service provider in New Zealand and don't plan on becoming a development shop, I still think they could make money training people. Have a 2 day course on how to conceptually improve your business as a service provider. Keep it general enough so that trade secrets aren't exposed, but at least make some money off of that great internal app.
Overall it was a great experience to be down there and meet alot of people. I can't wait to meet up with everyone again. I could talk about more, but it's 3am so I guess it's time for me to say goodnight. Hope you enjoyed this random post of information!
JoeDeveloper
35 comments