0

I need to convert image and audio into avi video files for use with a video mixing tool that only accepts avi video.

How do I:

  • convert mp3 audio to avi without video channel
  • convert jpg image to avi without sound

Without unnecessary re-encoding, if possible. Also, I think I can use black background image as an input, but I'd rather do without video channel altogether, if possible.

I would prefer a simple command-line solution, if possible.

6
  • Please update your question to clarify what you want more explicitly, since a valid answer was given, and you then claim you want something else in the comment. Specify it in the question, not the comments. – dobey Nov 28 '13 at 2:49
  • Did either of the answers provide an adequate solution? – llogan Dec 3 '13 at 0:00
  • Thanks, your solution did exactly what I asked for. It happened to not solve my actual problem, though, but that's the fault of my tool - turns out, it doesn't accept avi's without video track, and with less than 2 frames, too; and it demands a certain compression method. I guess I have to figure the exact requirements in the tool's discussion group. Thanks again! – Nickolai Leschov Dec 3 '13 at 18:35
  • I actually went along and re-installed FFmpeg for all users following your excellent tutorial. It worked! Do you think using this Jon Severinsson's FFmpeg PPA is a good option, too? It's linked from the FFmpeg homepage. I might need to install that earlier version to both use and build my tool against (it's not compatible with the latest ffmpeg yet). – Nickolai Leschov Dec 3 '13 at 18:41
  • You should use @LordNeckbeard so I get notified of your replies. I only saw these by chance. The PPA uses the 0.10 release branch of ffmpeg, which is considered old for general use, but it may be useful if your tool requires an older branch. – llogan Dec 3 '13 at 19:45
1
  1. Get the real ffmpeg. The fake ffmpeg from the repository is buggy. This command will download a recent static build of ffmpeg, so there is no installation required and it will not interfere with anything from the repository:

    wget http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.$(date +"%F").tar.gz
    tar xzvf ffmpeg.static.32bit.$(date +"%F").tar.gz
    
  2. Run the commands (note the ./ before ffmpeg):

    • convert mp3 audio to avi without video channel

      ./ffmpeg -i input.mp3 -map 0:a -codec:a copy output.avi
      
    • convert jpg image to avi without sound

      ./ffmpeg -loop 1 -i input.jpg -codec:v copy -t 10 output.avi
      

Notes:

  • The album art in MP3 files is considered to be a video stream by ffmpeg. Since you wanted no video using -map 0:a tells ffmpeg to copy only the audio stream from input 0 (the first input is 0, and in your case it is also the only input). Otherwise the default behavior is to include one stream per stream type from the input to the output (see stream selection for more info). Alternatively, -vn can be used instead.

  • -codec:a copy will enable stream copy mode. This just re-muxes the stream, so there is no re-encoding and no loss of audio quality.

  • -loop 1 will loop the input file, and -t 10 creates a 10 second output; otherwise it will loop forever. If you want a certain number of frames use -vframes instead.

  • By default the input image will have a frame rate of 25. If you want to change that then use -r as an input option (before -i). The output will then inherit the input frame rate. If you want to change the output frame rate as well, then add another -r as an output option. ffmpeg will then drop or duplicate frames to reach your desired output frame rate.

  • AVI is a container format and can use a variety of audio and video formats, so if something claims to only support "AVI" then you should ask for more specific information.

-1

You need a more generic video editing tool. Some options are Novacut and Blender, both of which should provide sufficient features to do what you need.

1
  • I would prefer a simple command-line solution, if possible. – Nickolai Leschov Nov 27 '13 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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