xyzio

Batch converting videos to play on the Nexus 7 using FFMPEG

leave a comment »

How to batch convert videos to play on the Nexus 7 using FFMPEG in Python.

mypath = r'path_to_video_files'

from os import listdir
from os.path import isfile, join
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ]

for file in onlyfiles:
    infile = '"' + mypath + file + '"'
    outfile = '"' + mypath + file + '.mp4' + '"'
    ffmpegpath = r'ffmpeg.exe'
    cmd = r' -i ' + infile + ' -acodec libmp3lame -vcodec libx264 -aspect 16:9 -s 800x480 -ab 128k -b 512k -f mp4 -strict experimental ' + outfile
    import os
    os.system(ffmpegpath + cmd)

Starting source:

http://stackoverflow.com/questions/8589976/how-to-convert-an-mkv-with-subtitles-to-something-nexus-one-friendly

Written by M Kapoor

September 29, 2014 at 3:01 pm

Posted in java

Tagged with

Leave a comment