View Full Version : Static image as a video source
Smirky
4th September 2009, 22:10
Recently I had an urge to upload a video to youtube which would have a static image throughout the whole video with music playing. There's a ton of such videos on youtube and I'm not a complete encoding newbie, meaning I've quite some before but I've never had a chance to learn or to come across using image as a video.
To cut the long story short - what is the most appropriate way and with what software this should be done? Maybe there is an avisynth script specifically for this where you call an image as a source?
Gavino
4th September 2009, 22:45
ImageSource (http://avisynth.org/mediawiki/ImageSource)
SynchronousArts
4th September 2009, 22:50
Use AVISynth, something like this:
# Read a single image, repeat 300 times
ImageSource("D:\static.png", fps=29.97, end=300)
SA
Smirky
4th September 2009, 23:31
Tried that one and also the last one with still image. Getting unsupported input file (DIB) error even though I added convert to YV12 at the end of the script. Image is in RGB. Using MeGui.
Guest
4th September 2009, 23:32
You have to use a proper frame size, i.e., proper multiples of 4 both ways. What's your frame size?
Smirky
4th September 2009, 23:37
Image size is 953x953, I tried lowering it to like 400x400 without loosing aspect ratio. I thought black borders (letterbox) would be added automagically. I guess I was wrong?
Guest
4th September 2009, 23:39
Did 400x400 work?
Smirky
5th September 2009, 00:32
Nope, did not
Guest
5th September 2009, 01:15
Post your exact script.
iffybob
5th September 2009, 03:48
What about doing it the other way round, embed an image in an MP3, I know you can do this, esp if its just one image.
Smirky
5th September 2009, 11:21
At first I used
video = ImageSource("C:\Users\*****\Downloads\ecliptica.jpg")
audio = DirectShowSource("C:\01. Blank File.mp3")
return AudioDub(video, audio)
It wasn't any good. Then I tried tweaking the video alone and used
ImageSource("C:\Users\*****\Downloads\ecliptica.jpg", fps=29.97, end=300) which asked me to add convert to YV12 that I tried doing and tried not to and still the same error.
Gavino
5th September 2009, 11:54
It wasn't any good.
What do you mean?
What error message are you getting, and from what software?
Smirky
5th September 2009, 12:29
What do you mean?
What error message are you getting, and from what software?
Mentioned here (http://forum.doom9.org/showpost.php?p=1322053&postcount=4)
P.S. So much bad luck: Windows Movie Maker can do that but it has like no features at all and can only render as WMV with no oprions whatsoever. Sony Vegas can do that easily too but gives a shitload of errors about mscvr90.dll and other stuff. Fixed that one and then another pops out. Hilarious. Will try Adobe Premiere soon...
Gavino
5th September 2009, 12:46
Just a thought - when adding ConvertToYV12(), did you do it like this:
return AudioDub(video, audio).ConvertToYV12()
If you add the ConvertToYV12() as a separate line, it will be ignored because of the 'return'.
Smirky
5th September 2009, 13:08
Just a thought - when adding ConvertToYV12(), did you do it like this:
return AudioDub(video, audio).ConvertToYV12()
If you add the ConvertToYV12() as a separate line, it will be ignored because of the 'return'.
You are right, video now can be made, but there is no audio and the video is only 41sec long (tried that with Xvid/x264 and mp3), x264 and aac give "pins cannot connect due to not supporting the same transport" error. This is becoming frustrating...
Guest
5th September 2009, 13:22
You are right, video now can be made, but there is no audio and the video is only 41sec long (tried that with Xvid/x264 and mp3) You have to give the correct parameters to ImageSource() to specify the length.
x264 and aac give "pins cannot connect due to not supporting the same transport" error. This is becoming frustrating... This is not clear? Exactly what actions lead to this?
Gavino
5th September 2009, 13:22
You need to set the video length (in frames) by setting the 'end' parameter to ImageSource. The actual length will be end+1.
The default is 1000, giving 1001 frames, just over 40 secs at 25fps.
You should get audio, does your "C:\01. Blank File.mp3" contain any sound? Post your script as it now is.
Smirky
5th September 2009, 13:29
video = ImageSource("C:\Users\Smirk\Downloads\ecliptica.jpg")
audio = DirectShowSource("C:\01. Blank File.mp3")
return AudioDub(video, audio).ConvertToYV12()
I need the video to end exactly when audio ends. I've encoded my .flac file to both mp3 and aac. Checked them both and they both play and have sound alright. Audio length is 4:05, meaning I should set 6125 frames or 6124?
Gavino
5th September 2009, 13:41
I need the video to end exactly when audio ends. I've encoded my .flac file to both mp3 and aac. Checked them both and they both play and have sound alright. Audio length is 4:05, meaning I should set 6125 frames or 6124?
What frame rate do you want for your video?
ImageSource gives 24fps by default, so 4:05 would be 245x24 = 5880 frames. So you would use end=5779.
For a different frame rate, specify fps in ImageSource and recalculate accordingly.
Smirky
5th September 2009, 13:50
I thought you said
The default is 1000, giving 1001 frames, just over 40 secs at 25fps.
so I calculated according to 25fps.
For youtube afaik it doesn't actually matter 24 or 25fps, so I don't know which one is more appropriate.
Gavino
5th September 2009, 14:08
Sorry I confused you with that. At that point, I was referring to the default length being 1001 frames, and thinking from your 41 secs timing that you probably had set the rate to 25fps yourself. In an earlier post, you had used 29.97.
The actual frame rate used for this probably doesn't matter since you have no moving pictures anyway.
Smirky
5th September 2009, 14:16
I used 24fps and 5779 frames. It came out 4:00sec. But the damn audio just won't mux. Some other weird thing: I adjusted CBR in Xvid to 1100kbps and the project size while encoding showed 16MB. After it was done the video was 2.3MB with 87kbps bitrate.
Update: I've found a nice script for that:
# SCRIPT VARIABLES #
audiosource="audio.mp3"
videosource="video.png"
framerate=1
thumbduration=6
# SET AUDIO/VIDEO #
audio1 = directshowsource(audiosource)
duration1 = audio1.Audiolength / audio1.Audiorate
video1 = ImageSource(videosource, end=duration1, fps=framerate).ConvertToRGB32
# ADD MINI THUMBNAIL #
duration2 = (duration1 - thumbduration) / 2
thumb1 = imagesource(videosource, end=thumbduration, fps=framerate).ConvertToRGB32.lanczos4Resize(19,14)
thumb2 = blankclip(thumb1, length=duration2, color=$000000)
thumb3 = blankclip(thumb1, length=duration2, color=$000000)
thumb4 = thumb2 + thumb1 + thumb3
video2=Layer(video1, thumb4)
# RETURN FINAL VIDEO #
return(video2)
But audio still doesn't mux, in Vdub too...
Guest
5th September 2009, 16:15
What are you using to mux? What container are you muxing to? What is the error that you receive?
Smirky
5th September 2009, 16:39
Ok. I've found scripts made by Frifox out here (http://tranceluvers.com/forum/index.php?showtopic=932) and they work perfectly. Thx to neuron2 and Gavino for great help and I'm definitely going to get to the bottom of my errors soon and will post as I do.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.