Friday, March 11, 2011

audio + video

figured out how to get an alternate audio into a video file: # take mp3 out of audio flv ffmpeg -i altAudio.flv -acodec copy altAudio.mp3 # take the video only out of the video mencoder -ni -ovc copy -nosound -o noAudio.mp4 origVideo.mp4 # put the audio and video together mencoder -ovc copy -oac copy -audiofile altAudio.mp3 -o out.avi noAudio.mp4 might not need both the ffmpeg step and -ni on the video extraction, but at least one of them is necessary. i tried without both and the video played at double speed while the audio was normal speed in the out.avi. might also be able to use a different format out with -of. not sure if avi transcodes it. EDIT: tried without -ni, still works fine. might need to adjust delay with - and +. also, i found that rtmpdump has very handy -e and -o options. i dropped the -A option with -e and it seems to work (kind of), not sure if that is absolutely necessary. now i'm trying to get mencoder on a file to let me playback faster. tried -vf filmdint and filmdint=io=2:1, and it doesn't hurt but doesn't seem to be essential. so far, best results are with just -fps 30000/1001 -ofps 20000/1001 and speed it up with ']'. -oac copy doesn't work; have to use something else like pcm (uncompressed) or mp3lame. the original audio is 48000Hz aac, which i can encode with -oac lavc -lavcopts acodec=aac, but that makes encoding really slow and messes up a/v sync, even when i try to compensate by changing -srate. so far this version looks promising, but the avi has no idx: mencoder -ovc copy -oac mp3lame -fps 30000/1001 -ofps 20000/1001 -o out.avi infile.mp4 could try -of mpeg or lavf, with a lavf format=mp4 for example, since the original is mp4 and plays pretty well (except when i speed it up too much). ok, this one seems to work pretty well: mencoder -ovc copy -oac mp3lame -fps 30000/1001 -ofps 20000/1001 -of lavf -lavfopts format=mp4 -o out.mp4 infile.mp4

No comments: