Monday, May 6, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2104  / 2 Years ago, mon, october 31, 2022, 4:48:24

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.


More From » software-recommendation

 Answers
5

  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.



[#28221] Tuesday, November 1, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
inglehare

Total Points: 330
Total Questions: 111
Total Answers: 95

Location: Sint Maarten
Member since Tue, Mar 29, 2022
2 Years ago
;