开发者

Join two flv files with PHP and ffmpeg

On my website I'm using phpmotion to convert videos into FLV files. What I want to do is that after the successful conversion of any new FLV file add short FLV file at the beginning.

So, I need FFMPEG command in PHP which will join开发者_运维百科 the file 1.flv (intro file) with 2.flv (successful converted file) and as a result create final.flv

I tried with:

ffmpeg -i 1.flv -i 2.flv -vcodec copy -acodec copy final.flv

But without result.

Thanks for any suggestion.


Here is the code, you have to seperate audio and video to raw files at first, join them then again convert back to flv

mkfifo temp1.a
mkfifo temp1.v
mkfifo temp2.a
mkfifo temp2.v
mkfifo all.a
mkfifo all.v
ffmpeg -i 1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null &
ffmpeg -i 2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null &
ffmpeg -i 1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
{ ffmpeg -i 2.flv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > temp2.v ; } &
cat temp1.a temp2.a > all.a &
cat temp1.v temp2.v > all.v &
ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
       -f yuv4mpegpipe -i all.v \
       -sameq -y output.flv
rm temp[12].[av] all.[av]


I guess you can use mencoder to merge two files.

mencoder -oac copy -ovc copy -o c:\video.flv c:\a.flv c:\b.flv
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜