DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Use Ffmpeg To Convert Flv To Mp4(or Avi)

09.30.2009
| 7748 views |
  • submit to reddit
        you should have your ffmpeg path into the environment variables first.
import os
from re import match
path='E:\\blender tutorials\\' #you should change the directory before you run this code.
files=os.listdir(path)
for f  in files:
    if match('.+\.flv$',f):
        outf=f.replace('.flv','.mp4') #change mp4 to avi if you want avi files.
        os.system(r'ffmpeg.exe -i "%s" "%s"'%(path+f,path+outf))