批量iPod视频编码器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了批量iPod视频编码器相关的知识,希望对你有一定的参考价值。

A simple python script for taking all files in the base dir and encoding them (and than removing them) into another folder. Handbrake, quality based, ipod nano compatible video, mac or windows.
  1. __author__ = "OtonVM"
  2. __date__ = "$Jan 15, 2010 2:18:00 PM$"
  3.  
  4. import sys
  5. import os
  6. import subprocess
  7. import os.path
  8.  
  9. if sys.platform == 'win32':
  10. source = r"C:UsersOtonDesktopHandBrake"
  11. if os.path.exists(r"C:UsersOtonDesktopHB Out") == False:
  12. os.mkdir(r"C:UsersOtonDesktopHB Out")
  13. destination = r"C:UsersOtonDesktopHB Out"
  14. encoder = sys.path[0] + r' oolshandbrakecliHandBrakeCLI.exe'
  15. audioFormat = "faac"
  16.  
  17. if sys.platform == 'darwin':
  18. source = r"/Users/Oton/Desktop/Encode"
  19. if os.path.exists(r"/Users/Oton/Desktop/HB Out") == False:
  20. os.mkdir(r"/Users/Oton/Desktop/HB Out")
  21. destination = r"/Users/Oton/Desktop/HB Out"
  22. encoder = sys.path[0] + r'/tools/handbrakecli/HandBrakeCLI'
  23. audioFormat = "ca_aac"
  24.  
  25. def encode(input, output):
  26. for root, dirs, files in os.walk(input):
  27. for file in files:
  28. (base, ext) = os.path.splitext(file)
  29. if ext.lower() == ".avi" or ext.lower() == ".mkv" or ext.lower() == ".mp4" or ext.lower() == ".m4v" or ext.lower() == ".mov":
  30. newfile = os.path.join(output, base + ".m4v")
  31. infile = os.path.join(root, file)
  32. if os.path.exists(newfile):
  33. print('Skipping file: ' + infile)
  34. else:
  35. encode = encoder + ' --encoder x264 --quality 30.0 --audio 1 --aencoder ' + audioFormat + ' --arate 44.1 --mixdown dpl2 --ab 96 --drc 2.0 --format mp4 --ipod-atom --maxHeight 240 --keep-display-aspect --modulus 16 --vfr --x264opts level=30:bframes=0:mbtree=1:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:8x8dct=0:me=umh:no-fast-pskip=1:no-dct-decimate=1:filter=-1,-1:qpmin=16:merange=128:subme=9:mixed-refs=0:trellis=0 --verbose 2' + ' -i "' + infile + '" -o "' + newfile + '"'
  36. subprocess.call(encode)
  37. os.remove(infile)
  38.  
  39. if __name__ == "__main__":
  40. encode(source, destination)

以上是关于批量iPod视频编码器的主要内容,如果未能解决你的问题,请参考以下文章

您可以播放 iPod 库中的视频吗?

如何在 iPod 仍在播放音频时将 iOS 上的视频静音?

MPMoviePlayerController 停止 iPod 播放并且不重新启动

JWPlayer 无法在 iPhone 和 iPod 中运行

如何利用ffmpeg将一小段视频截取成图片

iOS:降低包含 iPod 音乐的 MPMediaItem 的比特率