Giter Site home page Giter Site logo

l0lock / ffmpeg-bat-collection Goto Github PK

View Code? Open in Web Editor NEW
35.0 5.0 5.0 3.83 MB

A collection of .bat files for some usefull ffmpeg conversions.

Home Page: https://l0lock.github.io/FFmpeg-bat-collection/

License: GNU General Public License v3.0

Batchfile 76.73% HTML 12.98% JavaScript 2.60% SCSS 7.69%
ffmpeg ffmpeg-script batchfile batch batch-script

ffmpeg-bat-collection's Introduction

ffmpeg Bat Collection

GitHub license ko-fi

A collection of .bat files for some usefull ffmpeg conversions.

Bat files are supported in windows only.

Installation

Bat files work on their own, but you need to have the latest versions of ffmpeg installed, as well as ffprobe and ffplay (those two are packed along ffmpeg.exe)

  • Download the latest release and unpack it wherever you want.
  • If you don't have FFmpeg already, download the lastest "static" ffmpeg pack. You can either put the ffmpeg executables in the repository's ffmpeg folder, or register ffmpeg to your operating system (recommended!).
Click to expand: How to register ffmpeg in Windows
  • Browse in the archive up to the bin subfolder containing ffmpeg, ffprobe and ffplay executables. Uncompress the bin folder where you want. This guide will use: C:\ffmpeg\bin

  • Register ffmpeg, ffprobe & ffplay to environment variables

    Through command line (fastest):

    • Open the terminal (press Windows keyX and click Terminal)
    • enter the following command:
      setx PATH "%PATH%;C:\ffmpeg\bin"

    Through user interface:

    • Startmenu Search: "Edit Environment Variables for your account"
    • Environment variables
    • Under "User variables for <username>", find and double-click "Path"
    • New
    • Type in C:\ffmpeg\bin and ⏎ Enter
    • Ok
    • Ok
    • Ok

How to use

General usage

I.E. with files named as "Video_TO_xxx.bat".

These files are made to be the simplest to use :

  1. drag an drop your input file on the .bat file;
  2. a command prompt window opens during the process;
  3. once finished, the window disapears;
  4. the new files are located aside the originals.

Add Cover to X

Same general usage. But:
To make it work, you need to have your picture file in the same folder as the source video, named as cover.jpg.

demo covers

Do check those links first:

FileName Image Orientation Pixel Length of Smallest Side
cover.jpg Portrait or square 600
small_cover.png Portrait or square 120
cover_land.png Landscape 600
small_cover_land.jpg Landscape 120

Add Frame Number to X

Same general usage.
Uses Windows' "Courier New" font in bold by default, with a two-digits zero padding. If you need to customize:

  • Replace the font path line 8 in fontfile=/Windows/Fonts/courbd.ttf (**on Windows, don't use \ nor incllude the drive letter like C:)
  • Change the 2 to whatever digit number line 8 in {eif\:n\:d\:2}

demo frame number

Images sequence to X conversion

Use the files named as "ImgSeq_To_xxx.bat".

As it is more complex to manage images sequences, you need to:

Image sequence have some variable settings:

  • framerate (default used: 24)
  • start frame (default used: 1)
  • name pattern (default used: "frame_xxx.jpg")

If your need a different frame rate or start frame, feel free to edit the .bat file.

As for the name pattern, the easiest is to have your image files created with the same name pattern. You can also edit the .bat file.

To edit the name pattern, edit the value between quote marks. As for the frames numbering, here's how it works:
There's always a code like this one somewhere in the name pattern: %%03d. This is used to indicate the script that each file has a number that goes up for each file name. The way you write the code will indicate how he is compsed, and you can put the code anywhare in the name :

  • %% indicates where the numbers should start

  • if the counting is zero-padded (like 01 02 03...), write a 0

  • indicate the number of digits

  • end with a d

At the end of the filenane is always writen the file extension. It can be anything you need, like .jpg, .png, etc. Be aware that some formats like EXR need some special treatment, hence the dedicated .bat files for them.

To use the .bat files:

  1. Copy the desired .bat file in the images' folder

  2. Make sure the .bat settings fit your needs, edit the script or your files names if needed

  3. Double-click the .bat file

  4. A command prompt window opens during the process;

  5. Once finished, the window disapears;

  6. The new file is located aside the pictures.

Descriptions

Sets a custom cover/thumbnail for a MKV video file.

Sets a custom cover/thumbnail for a MP4 video file.

Prints the frame number on a MP4 video, with a semi-transparent background and a two-digit zero-padded number.

Prints the frame number on a MOV video, with a semi-transparent background and a two-digit zero-padded number.

Prints the frame number on a MP4 video, with a semi-transparent background and a two-digit zero-padded number.

Converts a JPG image sequence into a MP4 video. The output video is 24 frames per second encoded with an AVC/H264 standard medium quality.

Converts an EXR image sequence into a MP4 video, with settings specific to EXR files that are not suited for usual JPGs or PNGs. The output video is 24 frames per second encoded with an AVC/H264 standard medium quality.

Needs two input files, sort them alphabethically and produces two videos: one side-by-side horizontally and one stacked with overlay blend mode.

Creates an video file suited for playback on Android devices.

Creates a MKV file encoded with AOMedia Video 1 (AV1) codec, supposed to save 30% bitrate compared to VP9 and HEVC at the same visual quality (and 50% compared to AVC/x264). As of today, the encoder is extremely slow and **experimental **(encodes at ~0,01% of original video speed on my tests). Use at your own risk.

Creates an animated GIF file playing 24 frames per second, from any video file.

Creates an animated GIF file playing 30 frames per second, resized at 320 pixels wide (with the same ratio), from any video file.

Turns your video into a standard PNG image sequence. The files will be stored in a folder aside your original video file, with the same name, as the following:

| original_video.mp4
| original_video_name/
| | frame_xxxx.png

Frame counting is zero-paded and uses four digits.

Made for Instagram squares in mind, but can be used for anything. It does several things:

  • ensure maximum compatibility for displaying videos on mobile devices (including old ones) ;

  • ensures compatibility for Instagram ;

  • Resizes the video to fit it in a square while keeping the original aspect ratio ;

  • Fills the gaps left by the original video's ration by a blurred background effect.

You can change the output resolution if you want. Just open the bat file in a text editor, and edit the SquareSize value at line 5. The default value is 600 (pixels), you can use any integrer value you want. Just note that the higher you set, the longer it will take (because there's more data to process, blur increase time exponentially according to resolution) and Instagram doesn't displays more than ~600 pixels a square anyway.

Example:

example Instagram video

Creates a high quality HEVC file contained in MKV. That's what I use for file storage with quality.

Creates a standard MP4 file with fast h264 encoding. Good e.g. for quick previews of large files.

Creates a MP4 file made to be readable in most web services. While also making sure the size is dividable by 2 (otherwise some video files might not be readable in the Internet).

Creates a video file readable by discord and within the 8MB file size limit. Note that it adapts the encoding quality depending of the video duration. The longer the video, the uglier it gets. Dont try to send your movies with that 😉 .

ffmpeg-bat-collection's People

Contributors

l0lock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

ffmpeg-bat-collection's Issues

no visible thumbnail after encoding

i tested your dragndrop to android and was fascinated how it compresses my video from 10mb to 1,x mb. amazing!!!

i noticed the preview thumbnail was missing. while no error i am curious how it would look like with enabled preview thumbnail in windows.
thx

ffmpeg simple .bat question

Hi, sorry for bothering you. I'm new to .bat and ffmpeg in general. I recently found out a ffmpeg command I would like to use as a .bat script.

  1. dragn n drop xyz.mkv on .bat
  2. take xyz.mkv as input and output filename
  3. run ffmpeg script: ffmpeg -i xyz.mkv -af "pan=stereo|c0=c2+0.6*c0+0.6*c4+c3|c1=c2+0.6*c1+0.6*c5+c3" -c:v copy -codec:a ac3 -b:a 160k -ar 44100 -sn -dn xyz.mkv
  4. output location G: drive

Any help would be appreciated :)

okay this is working, but I don't know how to change the output location. I want to ouput to my usb drive which is G:

@echo off
:again

ffmpeg ^
	-i "%~1" ^
	-af "pan=stereo|c0=c2+0.6*c0+0.6*c4+c3|c1=c2+0.6*c1+0.6*c5+c3" -c:v copy -codec:a ac3 -b:a 160k -ar 44100 -sn -dn ^
	"%~p1%~n1.mkv"
if NOT ["%errorlevel%"]==["0"] goto:error
echo �[92m%~n1 Done!�[0m

I guess this has something to do with
%~1 - expands %1 removing any surrounding quotes (")
%~f1 - expands %1 to a fully qualified path name
%~d1 - expands %1 to a drive letter only
%~p1 - expands %1 to a path only
%~n1 - expands %1 to a file name only
%~x1 - expands %1 to a file extension only
%~s1 - expanded path contains short names only
%~a1 - expands %1 to file attributes
%~t1 - expands %1 to date/time of file
%~z1 - expands %1 to size of file

ffmpeg IF condition

Hi I have a .bat file to convert and change channel volume (with ffmpeg) from 5.1 Audio to Stereo, and a different .bat for Stereo/Mono Audio that doesn't change loudness.
Now I have to manually look if a movie is 5.1 or Mono/Stereo and decide which .bat to run. I would like to make one .bat with a condition so it looks what the channel layout is and then decide which profile to run. I hope this makes sense. It has to check also the language tag, because sometimes (in my case) german is 2.0 but English is 5.1 or vice versa.

Thank you for any advice

5.1

ffmpeg ^
	-i "%~1" ^
	-af "pan=stereo|c0=c2+0.6*c0+0.6*c4+c3|c1=c2+0.6*c1+0.6*c5+c3" -map 0:v:0 -c:v copy -map 0:a:m:language:ger -codec:a ac3 -b:a 160k -ar 44100 -sn -dn ^
	"G:\%~n1.mkv"

2.0/Mono

ffmpeg ^
	-i "%~1" ^
	-map 0:v:0 -c:v copy -map 0:a:m:language:ger -codec:a ac3 -b:a 160k -ar 44100 -sn -dn ^
	"G:\%~n1.mkv"

This is the whole .bat

@echo off
:again

ffmpeg ^
	-i "%~1" ^
	-map 0:v:0 -c:v copy -map 0:a:m:language:ger -codec:a ac3 -b:a 160k -ar 44100 -sn -dn ^
	"G:\%~n1.mkv"
if NOT ["%errorlevel%"]==["0"] goto:error
echo �[92m%~n1 Done!�[0m

shift
if "%~1" == "" goto:end
goto:again

:error
�
echo �[93mThere was an error. Please check your input file or report an issue on github.com/L0Lock/FFmpeg-bat-collection/issues.�[0m
pause
exit 0

:end
�
cls
echo �[92mEncoding succesful. This window will close after 10 seconds.�[0m
timeout /t 1

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.