AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 644313
Accepted
FreeSoftwareServers
FreeSoftwareServers
Asked: 2015-07-04 23:34:39 +0800 CST2015-07-04 23:34:39 +0800 CST 2015-07-04 23:34:39 +0800 CST

如何安装 Handbrake 和转换递归文件树

  • 772

问题:

  1. 安装 Handbrake cli
  2. 创建脚本以将所有文件从脚本进一步转换为文件树
  3. 从 GUI 获取示例选项
  4. 自动化是因为我很懒惰 [实际上我只是珍惜我的时间 :)]
scripts
  • 1 1 个回答
  • 2744 Views

1 个回答

  • Voted
  1. Best Answer
    FreeSoftwareServers
    2015-07-04T23:48:53+08:002015-07-04T23:48:53+08:00
    1. 安装 Just handbrake CLI,我使用无头服务器和 windows 前端!

    对于每年发布的推荐为马厩的最新版本......

    sudo add-apt-repository ppa:stebbins/handbrake-snapshots && sudo apt-get update && sudo apt-get install handbrake-cli
    

    对于稳定版本

    sudo add-apt-repository ppa:stebbins/handbrake-releases && sudo apt-get update && sudo apt-get install handbrake-cli
    
    1. 取消注释您希望使用的行和文件类型。您可以添加更多“预设/标志”,这只是一个想法。由于命名冲突,原始脚本在将 MP4 文件转换为 MP4 时出现问题。

      #!/bin/bash
      
      #Uncomment a Preset FLAGS and Uncomment a file type (mkv,avi,mp4)!
      
      # This Script Goes in Root Folder of TV show -- Example Folder Structure
      # /Stargate/Season\ 1/Epiosde.avi
      # /Stargate/Season\ 2/Epiosde.avi
      # /Stargate/handbrake.script
      # Outputs all Files back inside same dir's and does all folders inside Startgate DIR
      # /Stargate/Season\ 1/Epiosde.mp4
      # /Stargate/Season\ 2/Epiosde.mp4
      
      # FLAGS = flags for CLI can be got from GUI under Activity Log (In some versions) or from https://trac.handbrake.fr/wiki/CLIGuide (Flags can not have spaces, IE: No Presets, and can't have "'s, but you can just delete them, like --decomb="bob", the CLI accepts --decomb=bob
      
      ###Encode AC3 5.1
      
      #export FLAGS="-f mp4 -O --decomb=bob --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -E ac3 -6 5point1 -R 48 -B 448 --audio-fallback ac3 --encoder-preset=veryfast  --verbose=1"
      
      ###COPY AC3 5.1
      
      #export FLAGS="-f mp4 -O --decomb=bob --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -E copy:ac3 --audio-fallback ac3 --encoder-preset=veryfast  --verbose=1"
      
      ###Denoise & Encode AC3 5.1
      
      #export FLAGS="-f mp4 -O --decomb=bob --nlmeans=medium --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -E ac3 -6 5point1 -R 48 -B 448 --audio-fallback ac3 --encoder-preset=veryfast  --verbose=1"
      
      ###Denoise & COPY AC3 5.1
      
      #export FLAGS="-f mp4 -O --decomb=bob --nlmeans=medium --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -E copy:ac3 --audio-fallback ac3 --encoder-preset=veryfast  --verbose=1"
      
      if [ -z "$1" ] ; then
          TRANSCODEDIR="."
      else
          TRANSCODEDIR="$1"
      fi
          ###To use [&& find . -name '*.***' -delete] Uncomment and delete once to add to previous line of code
          ###Removes source files after completing ALL conversions. Use at your own risk!
      
          #AVI
          #find "$TRANSCODEDIR"/* -type f -name "*.avi" -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 $FLAGS' __ {} \; 
      #&& find . -name '*.avi' -delete
      
          #MKV 
          #find "$TRANSCODEDIR"/* -type f -name "*.mkv" -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 $FLAGS' __ {} \; 
      #&& find . -name '*.mkv' -delete
      
          #MP4 
          #find "$TRANSCODEDIR"/* -type f -name "*.mp4" -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}"-new.mp4 $FLAGS' __ {} \;
      ##&&find . -type f -not -name '*-new.mp4' -name '*.mp4' -delete && rename 's/-new//' *.mp4
      
    2. 我使用 Windows 程序并进行测试,直到找到完美的设置,然后在文件上运行它并单击活动窗口 >> 编码日志 >>(在日志开始处)这就是我得到的。

      CLI Query:  -i "C:\Users\donut\Downloads\TobeConverted\Love & Other Drugs (2010).avi" -t 1 --angle 1 -c 1 -o "C:\Users\donut\Downloads\ConvertedMedia\Love & Other Drugs (2010).mp4"  -f mp4  -w 720 --crop 68:70:0:0 --loose-anamorphic  --modulus 2 -e x264 -q 20 --vfr -a 1 -E ac3 -6 5point1 -R Auto -B 384 -D 0 --gain 0 --audio-fallback ac3 --markers="C:\Users\donut\AppData\Local\Temp\Love & Other Drugs (2010)-1-chapters.csv" --encoder-preset=veryfast  --encoder-level="5.2"  --encoder-profile=high  --verbose=1
      

    简单的版本是

    HandBrakeCLI -i source [flags] -o destination [flags]
    

    所以我不得不删除

    --markers="C:\Users\donut\AppData\Local\Temp\Love & Other Drugs (2010)-1-chapters.csv"
    
    1. My Alias 供无人值守使用。

      alias handfolder="sudo cp /media/handbrake.script ./ && sudo nano ./handbrake.script ; nohup ./handbrake.script > handbrake.nohup &"
      

    其中脚本名为 handbrake.script 并放置在 /media/handbrake.script 中。在要递归转换的目录底部使用此别名!

    • 1

相关问题

  • 如何在 Nautilus 中管理保存的完整网页及其目录(例如 n.html 和 n_files)

  • 如何每 5 秒运行一次脚本?

  • 如何将必须从其自己的目录中运行的程序添加到面板或主菜单?

  • 如何编写 shell 脚本来安装应用程序列表?

  • Mac OS X Automator 的替代品?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve