daily pastebin goal
74%
SHARE
TWEET

Convert FLV to MP4 with Python script (ffmpeg)

cpburnz Jun 21st, 2012 581 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # coding: utf-8
  2. """
  3. This script losslessly converts video files from FLV to MP4.
  4. """
  5.  
  6. __author__ = "Caleb Burns"
  7. __version__ = "0.1"
  8. __status__ = "Prototype"
  9.  
  10. import argparse
  11. import os.path
  12. import subprocess
  13. import sys
  14.  
  15. def main(argv):
  16.         parser = argparse.ArgumentParser(prog=argv[0], description=__doc__)
  17.         parser.add_argument('flv', nargs='+', help="The FLV files to convert to MP4.")
  18.         args = parser.parse_args(argv[1:])
  19.        
  20.         flvpaths = args.flv
  21.        
  22.         for flvpath in flvpaths:
  23.                 mp4path = os.path.splitext(flvpath)[0] + ".mp4"
  24.                 result = subprocess.call(['ffmpeg', '-i', flvpath, '-vcodec', 'copy', '-acodec', 'copy', mp4path])
  25.  
  26. if __name__ == '__main__':
  27.         sys.exit(main(sys.argv))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top