Author Topic: Export video from still image  (Read 241 times)

Cormy1

  • Newbie
  • *
  • Posts: 5
Export video from still image
« on: January 16, 2018, 09:59:11 PM »
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

  • Hero Member
  • *****
  • Posts: 5791
Re: Export video from still image
« Reply #1 on: January 17, 2018, 07:01:14 AM »
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

  • Newbie
  • *
  • Posts: 5
Re: Export video from still image
« Reply #2 on: January 17, 2018, 10:26:40 PM »
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

  • Hero Member
  • *****
  • Posts: 1667
Re: Export video from still image
« Reply #3 on: January 17, 2018, 10:55:02 PM »
I think ffmpeg is a better tool to accomplish at least the video part of the task: https://stackoverflow.com/questions/25891342/creating-a-video-from-a-single-image-for-a-specific-duration-in-ffmpeg

Cormy1

  • Newbie
  • *
  • Posts: 5
Re: Export video from still image
« Reply #4 on: January 18, 2018, 11:17:19 PM »
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

  • Hero Member
  • *****
  • Posts: 1667
Re: Export video from still image
« Reply #5 on: January 19, 2018, 07:18:41 AM »
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

  • Newbie
  • *
  • Posts: 5
Re: Export video from still image
« Reply #6 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, 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

  • Hero Member
  • *****
  • Posts: 1667
Re: Export video from still image
« Reply #7 on: January 25, 2018, 08:40:57 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:

Code: [Select]
-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.

Quote
How 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

  • Newbie
  • *
  • Posts: 5
Re: Export video from still image
« Reply #8 on: January 25, 2018, 08:40:40 PM »
???
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

  • Hero Member
  • *****
  • Posts: 1667
Re: Export video from still image
« Reply #9 on: January 25, 2018, 09:40:27 PM »
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.

Quote
As 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.