News:

--

Main Menu

Export video from still image

Started by Cormy1, January 16, 2018, 09:59:11 PM

Previous topic - Next topic

Cormy1

I want to take an image, take an audio track, and export a video whose length contains the entire audio track and have the still image shown at 1fps or something, fit to a 1920X1080 size with letterboxing if need be, how would I go about doing this?
Using 2.6.21, vanilla windows install.
As a sidenote, can I use AviDemux to record video from any sources such as a full screen application or an external video source provided by USB?

Jan Gruuthuse

Somewhere along this: add png then append video to it just don't add video to it.
- Once your video is created you can change the fps.
- Copy / paste the video  to the wanted duration
- Add Audio track

Avidemux is not (desktop) recording program. Search internet for "desktop recording" + "Your OS"

Cormy1

There must be a better way than copy-pasting images until you have the desired video length. Where do you change the fps exactly so that fewer pastes are required?
Is there no way to force the video length to contain whatever length of audio is in the project audio tracks?

eumagga0x2a


Cormy1

I'm not familiar with ffmpeg behaviour, would setting the scale to something that is different from the image's specifications yield distortion of the image to fit or would it add letterboxing?
In that particular thread you linked, the duration is manually set and is not based on the length of audio being input.
If I wanted to add audio, how would I do so? Why is loop set to 1 rather than 0?
I really have no idea what to do with ffmpeg, which is why I have been trying to go through something with a GUI like AviDemux.
It has the capability, it's just a matter of figuring out the best way of doing it without having to paste hundreds of times.

eumagga0x2a

Prepare the image using a proper image editing tool like GIMP, set the duration you need with -t (-loop 1 says ffmpeg to loop input, 0 would disable looping), don't use scaling. Mux the result again using ffmpeg and -c copy or use Avidemux for this purpose.

Cormy1

ffmpeg documentation says 0 parameter sets it to loop indefinitely, if you want to disable looping... You don't use the loop command at all. I would assume that I want to use the 0 parameter to loop throughout the video, which should be based on the length of the audio but you still say I need to set the duration manually and output a looping image video which I would then have to mux with the audio thereafter.
How should the image be prepared in GIMP?

eumagga0x2a

Quote from: Cormy1 on January 21, 2018, 12:02:38 AM
ffmpeg documentation says 0 parameter sets it to loop indefinitely, if you want to disable looping... You don't use the loop command at all. I would assume that I want to use the 0 parameter to loop throughout the video

No. From the ffmpeg manpage:

-loop_input
           Loop over the input stream. Currently it works only for image streams. This option is used for
           automatic FFserver testing.  This option is deprecated, use -loop 1.


This is exactly what is written in the command. You are going to loop the input for a given duration.

QuoteHow should the image be prepared in GIMP?

You wanted to fit it into 1920x1080 with letterboxing if needed. Create a black image 1920x1080 in size and paste your image into it, scale and center the image layer if necessary, export the result as a PNG without transparency.

Cormy1

???
Quote-loop_output number_of_times
    Repeatedly loop output for formats that support looping such as animated GIF (0 will loop the output infinitely). This option is deprecated, use -loop.
from https://www.ffmpeg.org/ffmpeg.html
There is also
Quote-stream_loop number (input)
    Set number of times input stream shall be looped. Loop 0 means no loop, loop -1 means infinite loop.
Seems I should be using either the first option with 0, or second option with -1 to loop indefinitely, for the duration of the video. If I set it to loop once, won't I end up with a bunch of empty frames that the picture wasn't looped for? Don't see any framerate adjustments either so if it isn't set to loop, will it show 1 frame for the entire duration or will it just be followed by many empty frames?


As I understand it, there is currently no way to do this within AviDemux without pasting dozens of the same picture is that right?

eumagga0x2a

I refer to the manpage of ffmpeg 3.4.1 which is installed on my system and to my own testing. The command works as expected, generates a video of given duration at 25 fps.

QuoteAs I understand it, there is currently no way to do this within AviDemux without pasting dozens of the same picture is that right?

While pressing Ctrl+C and then keeping Ctrl+V pressed for a while feels awkward, it works.

Cormy1

Since introducing the StillImage Filter I've been able to perform this task with ease, however I tried doing it today with a PNG and that seemed to cause an error when encoding, filtered playback works fine.
Why would there be an issue encoding the PNG...? I'm filtering, so it isn't copying, it should encode the png to jpeg as video frames.

I get the error:
"Cannot set up encoder. The configuration supplied to the encoder may be incompatible or the encoder may depend on features unavailable on this system."

Using Avidemux 2.7.7 200813, admlog says it couldn't initiliaze x264, changing codecs did not help.

eumagga0x2a

Are both width and height of the image even?

Cormy1

No, is that the issue? It worked when I converted it to JPG first, which had the same dimensions.

eumagga0x2a

Quote from: Cormy1 on August 24, 2020, 10:16:14 PMNo, is that the issue?

Sure.

Quote from: undefinedIt worked when I converted it to JPG first, which had the same dimensions.

If it worked, some intermediate stage like a video filter cropped or padded the size to an even value. x264 doesn't support odd dimensions.

By the way, width or height which is not a multiple of 16 strongly worsens compressibility and should be avoided (don't be fooled by the height of the full HD resolution 1920x1080 not being a multiple of 16: it is actually encoded as 1920x1088 with the bottom 8 pixels cropped away at the output stage).

Cormy1

As I said, the only difference was that it was a JPG rather than a PNG, the filters I employed did not change.
To create the JPG, I merely opened the PNG in Irfanview and then saved it has a 100Q JPG instead, no chroma subsampling.
How can I tell if the resolution was changed? Nothing seems to indicate that it has.

If 1080p is encoded as 1088 for the sake of compressibility, should not all resolutions that are not multiples of 8 be padded first automatically?
What kind of padding is applied? I assume it SHOULD duplicate the last line of pixels to achieve that multiple.