Swati
Swati

Reputation: 2918

Merge/Join images & video files together using mencoder or ffmpeg

Hi i have command to merge video files but i want to join an image to a video file.

What i am doing:

1) convert image to mp4 using ffmpeg

2) joining this converted video to my selected video using mencoder

but it prommpts an error: cannot mix video only files with audio-video files try -nosound.

i also added -nosound but with this the resultant file does not contains any audio.

what to do?

ffmpeg command:

-y -i Garden.jpg -s 640x480 converted.mp4

this converted .mp4 file is created properly but with no audio

mencoder command:

-oac mp3lame -ovc lavc -noodml -o output.mp4 converted.mp4 selected.mp4

Please help..

Upvotes: 0

Views: 5313

Answers (3)

jrkt
jrkt

Reputation: 2715

FFmpeg can accomplish this easily with the following command:

ffmpeg -i vid-1.mp4 -i vid-2.mp4 -ar 44100 -ab 64k -ac 1 -c:a libmp3lame -filter_complex '[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' output.mp4

Upvotes: 0

Doc Brown
Doc Brown

Reputation: 20044

Here is a free command line tool which can join MPEG 1 files:

http://mpgtx.sourceforge.net/#Download

(Windows exe available). Did not try it on my own, however.

EDIT: another alternative may be to utilize VirtualDub. You have to write your merge command to a script and pass the script name per command line:

http://www.virtualdub.org/blog/pivot/entry.php?id=20

However, you have to get yourself through the syntax of the scripting language

http://www.virtualdub.org/docs/vdscript.txt

(I did not try this by myself programmatically, have only used virtual dub via GUI interface to concat video files, which worked really well.)

Upvotes: 0

Shimmy Weitzhandler
Shimmy Weitzhandler

Reputation: 104781

If you target is Windows, converting the result to msmpeg4v2 (avi) or mpeg1video (mpg) or asf (wmv) would probably work best.

Note, ASF files often have .wmv or .wma extensions in Windows. It should also be mentioned that Microsoft claims a patent on the ASF format, and may sue or threaten users who create ASF files with non-Microsoft software. It is strongly advised to avoid ASF where possible.

Read this for full list.

Upvotes: 1

Related Questions