How to combine two differnt Image Sequences at different Frame Rates Into A Video with avconv & python? -
i have 2 sets of images have no problem combining separately avconv (with different rates using -r) 1 set @ -r .20 (extending 1 image 5 seconds of video ) , other set @ regular framerate assemble video @ regular speed.
when try combine these seperate avi files avconv or avimerge resulting video has frame rate of first video (-r .20)
is there way combine these 2 , both sequences in frame rates exported at?
here sloppy code put here:
try: p = subprocess.popen(["avconv" , "-y" , "-r" , ".20" , "-i" , "head%03d.jpg" , "-i" , audio , head_video_filename], universal_newlines=true, stdout=subprocess.pipe) out, err = p.communicate() retcode = p.wait() except ioerror: pass else: print "] encoding of header.avi finished:" + str(retcode) try: p = subprocess.popen(["avconv" , "-y" , "-i" , "tail%03d.jpg" , "-r" , "25" , tail_video_filename], universal_newlines=true, stdout=subprocess.pipe) out, err = p.communicate() retcode = p.wait() except ioerror: pass else: print "] encoding of tail.avi finished:" + str(retcode) try: group_of_videos = "concat:"+head_video_filename+"|"+tail_video_filename p = subprocess.popen(["avconv" , "-i" , group_of_videos , "-c" , "copy" , full_video_filename] , universal_newlines=true, stdout=subprocess.pipe) out, err = p.communicate() retcode = p.wait() except ioerror: pass else: print "] encoding of full_video.avi finished:" + str(retcode) return
#
i figured out more or less. these steps took although longer, more or less gives me 2 videos separate sources images , frame rates, chance encode them , add separate music track ending video. works still needs tweaking on frame rates (30, 29.x etc right)
encode first video sequence input @ .2 , export @ 30fpstry: p = subprocess.popen(["avconv" , "-stats" , "0" , "-y" , "-r" , ".2" , "-i" , "first%03d.jpg" , "-crf" , "1" , "-s" , "1280x720" , "-r" , "30" ,first_video_filename], universal_newlines=true, stdout=subprocess.pipe) out, err = p.communicate() retcode = p.wait() except ioerror: pass else: print "] encoding of first video finished: " + str(retcode)
encode second video sequence input @ 29.7fps , export @ 30fps try: p = subprocess.popen(["avconv" , "-stats" , "0" , "-y" , "-i" , "second%03d.jpg" , "-crf" , "1" , "-b" , "65536k" , "-s" , "1280x720" , "-r" , "30" , second_video_filename], universal_newlines=true, stdout=subprocess.pipe) out, err = p.communicate() retcode = p.wait() except ioerror: pass else: print "] encoding of second video finished: " + str(retcode)
combine avi's try: p = subprocess.popen(["mencoder" , "-forceidx" , "-ovc" , "copy" , "-o" , combined_video_filename , first_video_filename , second_video_filename] , universal_newlines=true, stdout=subprocess.pipe) out, err = p.communicate() retcode = p.wait() except ioerror: "* failed make combined video" pass else: print "] encoding of combined video finished:" + str(retcode)
# add audio mix track try: p = subprocess.popen(["avconv" , "-stats" , "0" , "-y" , "-i" , combined_video_filename , "-i" , combined_audio , "-c" , "copy" , "-crf" , "1" , "-b" , "65536k" ,"-shortest" , final_video_filename] , universal_newlines=true, stdout=subprocess.pipe) out, err = p.communicate() retcode = p.wait() except ioerror: "* failed make final video" pass else: print "] encoding of final video finished: " + str(retcode)
ham fisted, helps 1 day xoxoxox
Comments
Post a Comment