Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th February 2016, 04:16   #1  |  Link
.sk
Registered User
 
Join Date: Dec 2011
Posts: 7
Creating video from still image with MP4Box

I have a still png image and 40min long m4a audio.

Is is it possible to mux it so it will play as normal 40min long video?

This is for the purpose of later uploading to youtube.
.sk is offline   Reply With Quote
Old 6th February 2016, 06:06   #2  |  Link
mariush
Registered User
 
Join Date: Dec 2008
Posts: 589
You can use AviSynth to create a small script that will produce your video.

Once you install AviSynth you can open Notepad and after writing this, save the document with the extension .avs (save as... choose all file types, type at filename yourname.avs )

Code:
video = ImageReader("c:\path\to\your_image.jpg", fps=25, start=1, end=99999)
video
fps = 25 , the video generated on the fly will have a framerate of 25 , youtube will happily accept 25 or 30 frames per second with no problems.
start and end tell you how many frames to generate , so for example if your audio is 40 minutes long exactly, then you want 40 minutes x 60 seconds x 25 frames per second so you want to use end=60000

You should resize the image beforehand to a decent size, like 1920x1080 or 1280x720

It's ok for your video to be longer than audio by a few seconds, youtube won't mind.

Once you have this .AVS script, you can load it in Virtualdub or in MeGUI and compress the video using XVID or x264 , or you can use x264 directly using a command like this : x264.exe --tune stillimage --output "c:\path\to\output_file.mkv" "c:\path\to\avisynth_script.avs"

x264 is smart enough to recognize the still image so your video will compress super fast and will only use less than 1MB for each minute of video (it can be done to use even less but it's pointless for this exercise).

Now you can combine your generated video with your audio track, simply get MKVToolnix, open it, drag the two files in the gui and click the merge button and you'll get a MKV file with both video and audio, ready to be uploaded on Youtube.


As a tip, you can modify the script above to use more than one picture, for example here's the same script for two pictures :

Code:
sequence1 = ImageReader("c:\path\to\your_first_image.jpg", fps=25, start=1, end=10000)
sequence2 = ImageReader("c:\path\to\your_second_image.jpg", fps=25, start=1, end=10000)
video = sequence1+sequence2
video
This loads two pictures, each is shown on screen for 10000 frames ( 10000 frames / 25 fps = 400 seconds ) .. as long as both pictures have the same height and width.
mariush is offline   Reply With Quote
Old 6th February 2016, 11:02   #3  |  Link
.sk
Registered User
 
Join Date: Dec 2011
Posts: 7
Thanks a lot.

I ran into problem with non-compliant resolution (resolution is not compliant with colorspace i420) using x264 encoder.

Some way to automatically resize to mod2 resolution with width being 1280 and height kept within original aspect ratio?

I am looking for ways how to automate this process as much as possible.

By the way, how long this should take? I have i5 and ETA on 64600frames video was about 1 hour which does not seem right.
.sk is offline   Reply With Quote
Old 6th February 2016, 11:16   #4  |  Link
mariush
Registered User
 
Join Date: Dec 2008
Posts: 589
Yes, both width and height must be multiples of 2, but ideally they should be multiple of 8.

as for preparing pictures... see Irfanview ... very good free image viewer. But also allows you to crop pictures or add borders.

Image menu > Resize/Resample
Image menu > Change Canvas Size or Image menu > Add border/frame

There's also a very comprehensive batch conversion tool in Irfanview (File > Batch conversion/rename) , which would allow you to resize all pictures you have to have the width or height to a particular value and keep the proportions of each picture, and also set the canvas size to a particular size, all in one go. Hit the menu entry and then check the box "Use advanced options" and then hit the Advanced button, you'll see everything you'd need there.

On my computer (fx8320 , the video was encoded at around 70fps, so about 3x real time).

As a sidenote, once you have more than a few pictures, maybe it's time to look into video editing tools

ps. add --preset ultrafast to the x264 command line and it will run like crazy ... x264.exe --tune stillimage --preset ultrafast --output "c:\path\to\output_file.mkv" "c:\path\to\avisynth_script.avs"

It sacrifices thoroughness in trying to find the best way to compress each frame in the video in favor of speed, but in your case since we're dealing with the same picture over and over, the quality will still be quite good. On my pc, the speed goes up to around 205fps on average.

Last edited by mariush; 6th February 2016 at 11:26.
mariush is offline   Reply With Quote
Old 6th February 2016, 11:22   #5  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 7,903
for a still image encode use tune stillimage, reduce bframes to 0, ref frames to 1 and try -me dia (or is there a way to disable me completely)?

this should be faster.
huhn is offline   Reply With Quote
Old 6th February 2016, 12:14   #6  |  Link
.sk
Registered User
 
Join Date: Dec 2011
Posts: 7
Thanks for the tips.

To resize with avisynth, this might work..
Code:
x = float(height) / float(width)
spline64resize(1280, round(1280.0 * x / 8.0) * 8)
.sk is offline   Reply With Quote
Reply

Tags
mp4box, youtube

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:11.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.