linuxbashffmpegshmencoder

Convert images to a video file while keeping the same file name?


My intention would be to get at the same time, picture1.jpg, picture2.jpg, picture3.jpg to video format such as picture1.mp4, picture2.mp4, picture3.mp4.

I am currently using Mencoder and Linux bash code mencoder mf: //*.jpg -mf w = 1366: h = 768: fps = 6/60: type = jpg -ovc copy -oac copy -o images.mp4. But this command makes all the images into one video file (images.mp4).

Can I do it with mencoder or ffmpeg? My linux bash coding skills are basic.


I found a solution that works for me as I want. Thank you to all who helped me.

#! /bin/bash
for input in *.jpg
do
mencoder -ovc copy -mf w=1366:h=768:fps=1/11:type=jpg -ofps 30000/1001 mf://"$input" -o $(echo $input | sed -e 's/.jpg$/.mp4/')
done

Solution

  • I am not entirely sure on what kind of videos you want, but the basic pattern for doing a conversion for a bunch of files is

    for input in *.jpg
    do
      output=$(echo $input | sed -e 's/.jpg$/.mp4/')
      # whatever command including $input and $output
    done