Giter Site home page Giter Site logo

digiex / m4v-converter Goto Github PK

View Code? Open in Web Editor NEW
22.0 6.0 3.0 372 KB

This script automates media conversion to a universal MP4 format using FFmpeg.

Home Page: https://digiex.net/threads/m4v-converter-convert-your-media-to-a-universal-format-nzbget-sabnzbd-automation-linux-macos.14997/

License: GNU General Public License v3.0

Shell 99.46% Dockerfile 0.54%
mp4 nzbget sabnzbd ffmpeg docker

m4v-converter's Introduction

M4V-Converter

This script automates media conversion to a universal MP4 format using FFmpeg.

Fully integrates with NZBGet so that media converts automatically on post-process! SABnzbd is also supported although it does not get a WebUI config, though can still be configured using a config file!

Tested on x86-64 alpine/ubuntu/macOS and arm64 macOS (Apple Silicon/M1)

Found a bug? Report it here!

Dependencies

Requires bash version 4 or greater, ffmpeg, ffprobe and jq

Ubuntu:

apt-get update
apt-get install ffmpeg jq

Alpine:

apk update
apk add bash ffmpeg jq

macOS: Requires Homebrew

brew update
brew install bash ffmpeg jq

When using macOS the default bash is still only version 3 and if you want to use the NZBGet.app or SABnzbd.app with the script you will need to do the following to correct PATH issues:

  1. Find the PATH to bash, which bash This should return either /opt/homebrew/bin/bash (arm64) or /usr/local/bin/bash (x86) depending on your Mac architecture

    • NZBGet: Open the NZBGet webui, go to settings, extension scripts, look for ShellOverride, give it the PATH to the newer version of bash. This should look like: .sh=/opt/homebrew/bin/bash
    • SABnzbd: Edit the script, change line 1 #!/usr/bin/env bash to the PATH of the newer version of bash. This should look like: #!/opt/homebrew/bin/bash

One solution that works for both is to set a launchctl environment variable, You can do so with the following:

launchctl setenv PATH $PATH
killall Dock

If you have the NZBGet.app or SABnzbd.app already running you will need to restart them.

NOTE: If you choose not to use the launchctl solution, remember to also set the PATH for ffmpeg, ffprobe and jq in either the NZBGet webui or mp4.conf for SABnzbd

Usage

Example commands

./mp4.sh -i /path/to/process

./mp4.sh -v -i /path/to/process -c /path/to/config

./mp4.sh -v -i /path/to/process --video-codec=hevc --dual-audio=true --normalize=true

Docker

Example Docker commands

docker run -it --rm \
  -v /path/to/process:/input \
  ghcr.io/digiex/mp4:latest -i /input
docker create \
  --name nzbget \
  -p 6789:6789 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=America/New_York \
  -v /path/to/appdata:/config \
  -v /path/to/downloads:/downloads \
  ghcr.io/digiex/nzbget:latest
docker create \
  --name sabnzbd \
  -p 8080:8080 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=America/New_York \
  -v /path/to/appdata:/config \
  -v /path/to/downloads:/downloads \
  ghcr.io/digiex/sabnzbd:latest

Docker Compose

Examples for docker-compose

nzbget:
  image: ghcr.io/digiex/nzbget:latest
  container_name: nzbget
  environment:
    - PUID=1000
    - PGID=1000
    - TZ=America/New_York
    - UMASK_SET=022
  volumes:
    - /path/to/appdata:/config
    - /path/to/downloads:/downloads
  ports:
    - 6789:6789
  restart: unless-stopped
sabnzbd:
  image: ghcr.io/digiex/sabnzbd:latest
  container_name: sabnzbd
  environment:
    - PUID=1000
    - PGID=1000
    - TZ=America/New_York
    - UMASK_SET=022
  volumes:
    - /path/to/appdata:/config
    - /path/to/downloads:/downloads
  ports:
    - 8080:8080
  restart: unless-stopped

Configuration

Running the script once ./mp4.sh will create a mp4.conf file, You may edit these settings to your liking. You can also specify a location to this file (if one already exists) by using -c /path/to/mp4.conf or --config=/path/to/mp4.conf.

Credits & Useful Links

This project makes use of the following:

Useful links:

Enjoy

m4v-converter's People

Contributors

xzkingzxburnzx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

trouble-51 rcfilm

m4v-converter's Issues

How to use the scripts after they changed

I’m sorry to ask how do I use the scripts newest version?

The reason is that I unfortunally have lost the old version and the read me file hasn’t been updated so unfortunally I haven’t been able to figure out how the new script works

Getting the script to use same path as in source

First of all thank you very much for the great script. I have great use of it in the work of converting my personal dvd rips with makemkv to smaller files for plex.

I would like to know if there is a way for the script to use same folder structure in the output as the files are in the input?

The reason is that my next project is to rip my dvd series boxes and is sorting the files right away and would like to be able to put the output directly in the plex servers folders with the same structure.

Bash 4 not found in nzbGet

Hey, I keep getting "M4V-Converter: Sorry, you do not have Bash version 4 or later" in nzbGet as it wants to start the post-processing...

I cannot seem to debug it, my bash is fine and installed.

Setup is on a MacBook Pro with High Sierra, and nzbGet. (Edit: and bash 4.4)
Any tips? Thanks!

NZBGET in docker container

HI,

i've installed FFMPEG on my main system but i think because of running NZBGET in a docker container m2v script doenst see the ffmpeg installed on the main system.

Can you help ?

ps.

Thank you for this great script.

Default it to keep 5.1 audio

I'm sorry to ask again but are there a way to get it to use 5.1 audio only if there is a 5.1 audio track and only use 2.0 audio if there isnt a 5.1 audio track?

Trying to convert m4v fails with

No decoder for stream #0:1, filtering impossible

Stream #0:1 of the file in question looks like this:
Stream #0:1(eng): Video: none (drmi / 0x696D7264), none(tv, bt709, progressive), 1920x1080, 5121 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 2017-05-07T12:33:52.000000Z
handler_name : Core Media Video

Any help appreciated but not expected :)

MacOS Sierra could be good to know I guess, reproduced on Ubuntu 16.04 as well

Remuxing instead of encoding?

Hi there, thanks for your amazing effort in the script, works really well for converting.

However I want to just remux the files into a different container (mp4) instead of re-encoding the file to reduce file size, however I still want to convert the audio to AAC and use the dual to get both the original surround and AAC.

I cant find an option to avoid re-encoding however I know ffmpeg has a --codec option but this appears to be missing.
Any ideas?

bash: warning: shell level (1000) too high, resetting to 1

I'm on Unraid 6.8.3 and I have the NZBGet with the script installed in docker.

When I run the mp4.sh script, I get this error:

bash: warning: shell level (1000) too high, resetting to 1

I had to add ffmpeg and ffprobe to /boot/config/go file with the following command cp /boot/ffmpeg-git/ffmpeg /usr/local/sbin and cp /boot/ffmpeg-git/ffprobe /usr/local/sbin

Any idea what's wrong?

Permission denied error

I'm trying to start the application via docke in a RPI 4r:

docker run -it --rm
-u 1001:100
-v /mypath/to/process/xxx/:/input
digiex/mp4 -i /input -c /input/mp4.conf

But I get the following error all the time:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: "/mp4/mp4.sh": permission denied": unknown.

Thanks for your work and time.

Keep getting errors when running script

This is the message i get when trying to convert a MKV file:

Processing directory[1 of 1]: /Users/jos/Downloads/complete/Designated.Survivor.S01E01.1080p.HDTV.x264-CROOKS.1
Processing file[1 of 5]: /Users/jos/Downloads/complete/Designated.Survivor.S01E01.1080p.HDTV.x264-CROOKS.1/designated.survivor.s01e01.1080p.hdtv.x264-crooks.mkv
Converting...
Result: success
Conversion efficiency at 429457914878%; Original=4.0GB; Converted=915MB
Processing file[2 of 5]: /Users/jos/Downloads/complete/Designated.Survivor.S01E01.1080p.HDTV.x264-CROOKS.1/designated.survivor.s01e01.1080p.hdtv.x264-crooks.nfo
File does not have the expected extension, attemtping...
File is missing audio
Processing file[3 of 5]: /Users/jos/Downloads/complete/Designated.Survivor.S01E01.1080p.HDTV.x264-CROOKS.1/Designated.Survivor.S01E01.1080p.HDTV.x264-CROOKS.nzb
File is not convertable

and this last messages is repeated for file 4 and 5

Please help me understand what I am doing wrong

Thanks,

Jos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.