Skip to content

Generate still video from an audio and image file, through machine (via "ffmpeg").

License

Notifications You must be signed in to change notification settings

nodef/extra-stillvideo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate still video from an audio and image file, through machine (via "ffmpeg").

Do you want to:

Sample: "Pixelsphere OST (2017)".

setup

  1. Install [Node.js], if not installed.
  2. Run npm install -g extra-stillvideo in [console].
  3. To install this as a package use npm install extra-stillvideo.

console

stillvideo -a bomberman.m4a -i bomberman.png
# out.mp4 created (yay!)

stillvideo -a speech.mp3 -i photo.jpg -o speech.mp4
# speech.mp4 created from audio speech.mp3, image photo.jpg

reference

stillvideo [options]
# --help:    show this help
# -l, --log: enable log
# -o, --output: set output video file (out.mp4)
# -a, --audio:  set input audio file
# -i, --image:  set input image file
# -ol, --loop:      set loop (1)
# -of, --framerate: set framerate (1)
# -ov, --vcodec:    set vcodec (libx264)
# -oc, --crf:       set CRF (0)
# -op, --preset:    set preset (veryfast)
# -ot, --tune:      set tune (stillimage)
# -oa, --acodec:    set acodec (copy)
# -rx, --resizex:   set image resize-x
# -ry, --resizey:   set image resize-y
# -fx, --fitx:      set image fit-x
# -fy, --fity:      set image fit-y

# Environment variables:
$STILLVIDEO_LOG # enable log (0)
$STILLVIDEO_OUTPUT # set output video file (out.mp4)
$STILLVIDEO_AUDIO  # set input audio file
$STILLVIDEO_IMAGE  # set input image file
$STILLVIDEO_LOOP      # set video loop (1)
$STILLVIDEO_FRAMERATE # set video framerate (1)
$STILLVIDEO_VCODEC    # set video vcodec (libx264)
$STILLVIDEO_CRF       # set video CRF (0)
$STILLVIDEO_PRESET    # set video preset (veryfast)
$STILLVIDEO_TUNE      # set video tune (stillimage)
$STILLVIDEO_ACODEC    # set video acodec (copy)
$STILLVIDEO_RESIZEX   # set image resize-x
$STILLVIDEO_RESIZEY   # set image resize-y
$STILLVIDEO_FITX      # set image fit-x
$STILLVIDEO_FITY      # set image fit-y

package

const stillvideo = require('extra-stillvideo');

await stillvideo('out.mp4', 'bomberman.m4a', 'bomberman.png');
// out.mp4 created (yay!)

await stillvideo('speech.mp4', 'speech.mp3', 'photo.jpg');
// speech.mp4 created from audio speech.mp3, image photo.jpg
const stillvideo = require('extra-stillvideo');

stillvideo(output, audio, image, options={})
// output:  output video file
// audio:   input audio file
// image:   input image file
// options: given below
// -> Promise <output>

// Default options
options = {
  stdio: [0, 1, 2],   // set child process stdio
  log: false,         // enable log
  loop: 1,            // set loop
  framerate: 1,       // set framerate
  vcodec: 'libx264',  // set vcodec
  crf: 0,             // set CRF
  preset: 'veryfast', // set preset
  tune: 'stillimage', // set tune
  acodec: 'copy',     // set acodec
  resizeX: 0,         // set image resize-x
  resizeY: 0,         // set image resize-y
  fitX: 0,            // set image fit-x
  fitY: 0             // set image fit-y
}

similar

Do you need anything similar?

Suggestions are welcome. Please create an issue.

nodef