2

I have a list of short audio mp3 files. Is there any software which can automatically merge them into a video which show the name of the original audio files while playing them?

For example suppose I have three audio files human.mp3, animal.mp3 and plant.mp3. I want to create a video which plays the all the three audios and while playing human.mp3 it shows the text human, while playing while playing animal.mp3 it shows the text animal and while playing plant.mp3 it shows the text plant. So the video show nothing other than text and play the audios.

I'm using Ubuntu and I'm going to use such software in Ubuntu.

3
  • Free or paid? Which OS? Which format should the end video be in? Commented Nov 13, 2014 at 21:58
  • Well I prefer a free one. And I prefer a linux-based one. Commented Nov 13, 2014 at 21:59
  • 1
    format of the video is unimportant. Commented Nov 13, 2014 at 22:03

2 Answers 2

3

You can use ImageMagick (Free, open source, cross-platform, CLI) to create an image from some text:

convert \
    -size 165x70 \
    xc:lightblue \
    -font Bookman-DemiItalic \
    -pointsize 12 \
    -fill blue \
    -gravity center \
    -draw "text 0,0 'It is 28 degrees today'" \
    image.png

Then you can use FFmpeg (free and open-source, Windows/Linux/Mac, CLI) to take one image and an audio file as input and generate a video file of the same duration as the audio file, e.g.:

ffmpeg -loop 1 -i image.jpg -i audio.wav -c:v libx264 -tune stillimage \
-c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest out.mp4

Lastly you can use FFmpeg to concatenate the resulting video files.

6
  • The problem is that there are a lot of short mp3 files. And I may need to do this many times for various sets of audio files. I hope there is an automatic way of creating the images using the file names and deriving the movie from them. Commented Nov 14, 2014 at 3:16
  • 1
    All the above-mentioned tools are CLI, so you can always script around (which I know is not the best solution but in this case I'd be surprised if there exist some pre-packaged solution). Commented Nov 14, 2014 at 3:18
  • Can it be done with shell-script for loop for files in a folder? Commented Nov 14, 2014 at 3:20
  • @MinimusHeximus yes. Commented Nov 14, 2014 at 3:26
  • my ffmpeg has a problem with the option -tune Commented Nov 14, 2014 at 3:48
2

To complete Franck Dernoncourt's answer: Create a bash script named 0moviemakingscript.sh in the folder which contains the audio files with contents:

#!/bin/bash

for f in *; do
    if [ "$f" != "0moviemakingscript.sh" ]
    then
        mv "$f" "${f%.*}";
        convert -size 450x280 xc:lightblue -font Bookman-DemiItalic -pointsize 40 -fill blue -gravity center -draw "text 0,0 '$f'" "$f.png";
        ffmpeg -i "$f.png" -i "$f" "$f.avi";
    fi
done

for f in *.avi; do
    echo "file '$f' ";
done > 0.txt

ffmpeg -f concat -i 0.txt -c copy 0merged.avi

Open terminal and cd to the folder and then run the script:

sh 0moviemakingscript.sh

and wait unftil the final video named 0merged.avi is created.

This script removes the extension from original audio files and it is assumed that the folder does not contain anything other than the audio files and 0moviemakingscript.sh. So you may need to copy the folder to a temporary folder to created the video. Also note that you can use avconv instead of ffmpeg. Since avconv seems to be derived from ffmpeg, I think arguments need not change.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.