0

I have an audio file which I would like to convert to a video. If possible, I would like to use a static image for appearing at the video. I have investigated a couple possible solutions, but non of them is fully functional.

This solution in previous thread

ffmpeg -loop_input -shortest -y -i image8.jpg -i sound11.mp3 -acodec copy -vcodec mjpeg result.avi

does not work any more, as it does not extend the video to the duration of the audio file. Additionally, ffmpeg complains that it is deprecated and suggests to use avconv instead.

avconv -i sound11.mp3 -strict experimental -i 341410.jpg -map 0:a  out.mp4

but the image does not appear

Finally I have tried with gstreamer

gst-launch filesrc location=deltio.mp3 ! mp3parse ! mp4mux name=mux filesink location=output.mp4  filesrc location=341410.jpg ! jpegdec ! x264enc ! mux.

but I get an error

ERROR: from element /GstPipeline:pipeline0/GstX264Enc:x264enc0: Can not initialize x264 encoder. 
Additional debug info: gstx264enc.c(1269): gst_x264_enc_init_encoder (): /GstPipeline:pipeline0/GstX264Enc:x264enc0 
ERROR: pipeline doesn't want to preroll.

Since I want to include this conversion into a Python script, the latter solution seems the best, as there is a Python wrapper for GStreamer

Community
  • 1
  • 1
lefterav
  • 12,963
  • 1
  • 13
  • 14
  • Please show the complete ffmpeg console output to show any actual errors. The ["deprecated" message is misleading](http://stackoverflow.com/a/9477756/1109017). – llogan May 05 '13 at 18:09

2 Answers2

1

Them are some old commands there. I have a script for this purpose, essentially this

ffmpeg -loop 1 -r 1 -i img.png -i song.m4a -qp 0 -filter:v 'crop=trunc(iw/2)*2' \
  -c:a aac -strict -2 -b:a 384k video.mp4
Steven Penny
  • 82,115
  • 47
  • 308
  • 348
0

a common problem when when connecting multiple GStreamer video elements is that the elements only support incompatible video formats. usually the ffmpegcolorspace element can convert between most of those formats, so try:

gst-launch \
    filesrc location=deltio.mp3 \
    ! mp3parse \
    ! mp4mux name=mux filesink location=output.mp4 \
    filesrc location=341410.jpg \
    ! jpegdec ! ffmpegcolorspace ! x264enc ! mux.
umläute
  • 23,410
  • 4
  • 50
  • 99