summaryrefslogtreecommitdiffstats
path: root/convert2mp4
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-04-13 22:06:00 +0200
committerFlorian Pritz <bluewind@xinu.at>2014-04-13 22:06:00 +0200
commit997b528911b906a9559ac030b1a7a789401f4d13 (patch)
tree93630a005db6754141ab20f80ce3d121975240fb /convert2mp4
parent2469d49396a13aeef8e26d8f12162e3be91c445a (diff)
downloadbin-997b528911b906a9559ac030b1a7a789401f4d13.tar.gz
bin-997b528911b906a9559ac030b1a7a789401f4d13.tar.xz
remove unused scripts
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'convert2mp4')
-rwxr-xr-xconvert2mp4116
1 files changed, 0 insertions, 116 deletions
diff --git a/convert2mp4 b/convert2mp4
deleted file mode 100755
index 1e8e975..0000000
--- a/convert2mp4
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/python2
-#----------------------------------------------------
-# Author: Florian "Bluewind" Pritz <flo@xssn.at>
-#
-# Licensed under WTFPL v2
-# (see COPYING for full license text)
-#
-#----------------------------------------------------
-# Converts a file to an MP4 which can be played in a flash movie
-# Video: H264
-# Audio: MPEG-4 AAC
-#----------------------------------------------------
-
-'''"usage: %prog [options] <files>'''
-__version__ ='0.2'
-__desc__ = 'Use ++ before any argument to pass it directly to ffmpeg.(i.e. ++-r ++25)'
-
-import sys
-import os
-import subprocess
-from optparse import OptionParser
-
-def main():
- usage = "usage: %prog [options] <files>"
- p = OptionParser(version=__version__, usage=__doc__, description=__desc__)
- p.add_option("-s", "--size", dest="size", default=False,
- help="use <dimension> instead of input dimensions (e.g. 123x123)", metavar="<dimension>")
- p.add_option("--vb", dest="vbitrate", default="400000",
- help="change the video bitrate", metavar="<bitrate>")
- p.add_option("--ab", dest="abitrate", default="160000",
- help="change the audio bitrate", metavar="<bitrate>")
- p.add_option("-m", "--map", action="append", dest="maps", default=None,
- help="change the mappings", metavar="<input_stream_id:sync_stream_id>")
- p.add_option("--nd", action="store_false", dest="deinterlace", default=True,
- help="don't deinterlace the video")
-
- (options, args) = p.parse_args()
-
-
- if len(args) == 0:
- p.print_help()
- sys.exit()
-
- ffmpeg_args = []
-
- if options.size:
- ffmpeg_args.append("-s")
- ffmpeg_args.append(options.size)
- if options.vbitrate:
- ffmpeg_args.append("-b")
- ffmpeg_args.append(options.vbitrate)
- if options.abitrate:
- ffmpeg_args.append("-ab")
- ffmpeg_args.append(options.abitrate)
- if options.deinterlace:
- ffmpeg_args.append("-deinterlace")
- if options.maps:
- for cur_map in options.maps:
- ffmpeg_args.append("-map")
- ffmpeg_args.append(cur_map)
-
- for name in args:
- if name.startswith('++'):
- ffmpeg_args.append(name[2:])
-
- for name in args:
- if name.startswith('++'):
- continue
- p1 = subprocess.Popen(["echo", "-n", name], stdout=subprocess.PIPE)
- p2 = subprocess.Popen(["sed", "s/\(.*\)\..*/\\1/"], stdin=p1.stdout, stdout=subprocess.PIPE)
- name_mp4 = "tmp_" + p2.communicate()[0] + ".mp4"
- for encpass in ["1", "2"]:
- if encpass == "1":
- filename = "/dev/null"
- ffmpeg_args.append('-vpre')
- ffmpeg_args.append('medium_firstpass')
- else:
- filename = name_mp4
- ffmpeg_args.append('-vpre')
- ffmpeg_args.append('medium')
- subprocess.Popen(merge(
- [["ffmpeg", "-i", name,
- "-vcodec", "libx264",
-# "-r", "25",
-# "-g", "250", "-keyint_min", "25",
-# "-vpre", "hq",
-# "-coder", "ac", "-me_range", "16",
-# "-subq", "5", "-sc_threshold", "40",
- "-acodec", "libfaac",
-# "-ar", "44100",
-# "-cmp", "+chroma", "-partitions", "+parti4x4+partp8x8+partb8x8",
-# "-i_qfactor", "0.71", "-b_strategy", "1",
- "-threads", "0",
- "-pass", encpass,
- "-f", "mp4",
-# "-crf", "30",
- "-y"],
- ffmpeg_args, [filename]]
- )).communicate()[0]
-
- subprocess.Popen(["qt-faststart", name_mp4, "done_"+name_mp4]).communicate()[0]
-
-def merge(seq):
- merged = []
- for s in seq:
- for x in s:
- merged.append(x)
- return merged
-
-def file_exists(filename, options):
- if os.path.exists(filename) and not options.force:
- sys.stderr.write('Target "'+filename+'" already exists. Use --force to overwrite.\n')
- sys.exit(1)
-
-if __name__ == '__main__':
- main()