Giter VIP home page Giter VIP logo

bat_ffmpeg's Introduction

BAT_FFMPEG 🎥

About

Batch script files for FFMPEG (Microsoft Windows and DOS, OS/2 )

My collection of scripts :)
For converting (audio, video, ...) files using FFMPEG :)

ToDo and Future

add https://github.com/nagadomi/waifu2x
add boomerang GIFs https://superuser.com/questions/1608327/ffmpeg-boomerang-effect-to-gif
add image2pipe and video pipe2image https://stackoverflow.com/questions/46397240/ffmpeg-image2pipe-producing-broken-video
add slow-down or speed-up gifs: http://blog.floriancargoet.com/slow-down-or-speed-up-a-gif-with-imagemagick/ add feature to download video by timestamp https://youtu.be/lFKw9zlA2fw?t=16

How to use:

  1. Edit the batch script to your liking. For example, where to trim the video.
  2. Just drag a video or audio file onto the batch file. :)

Logic

All files have MAIN Code - where you can find main command(s) for ffmpeg.exe
This main command has comment mark:
REM //////////////////// MAIN \\\\\\\\\\\\\\\\\\\\\\\\\
Than main code-command(s) for ffmpeg.exe (Video-ToMP4_FPS-24-25-30-60.bat for example):

 ffmpeg -i %%x -r 30 -vcodec libx264 -acodec copy -map_metadata 0 -map 0 -threads 1 "%%~nx_output_FPS30.mp4"

Scripts

Audio-AudioGain.bat

Gain (Increase) the sound volume of a file on 50% MAIN Code:

ffmpeg -i %%x -filter:a "volume=1.5" -ar 44100 -ac 2 -q:a 0 -map_metadata 0 -id3v2_version 3 "%%~nx_output_GAIN%%~xx"

Audio-ToMP3_RemoveSideData.bat

useful for: remove ReplayGain

This bat file doesn't reconvert the original mp3 - because it is the fastest way.
In the same way, it doesn't change the original quality.
But on the other hand, it removes all sidedata from metadata (but save all metadata)
Read this about sidedata and lameinfo (xing) "The ‘lame’ (or xing) header is not officially part of the mp3 specification"
https://eyed3.readthedocs.io/en/latest/plugins/lameinfo_plugin.html

Video-ToMP4_FPS-24-25-30-60.bat (How to change frame rate of video, fps of video by ffmpeg.exe?)

Can change frame rate or FPS of video and recode it to container .mp4 & video codec x264.
By default it is -r 30 - 30 FPS. Choose what you want in MAIN Code:

REM ffmpeg -i %%x -r 24 -vcodec libx264 -acodec copy -map_metadata 0 -map 0 -threads 1 "%%~nx_output_FPS24.mp4"
REM ffmpeg -r "25" -i %%x -vcodec libx264 -acodec copy -map_metadata 0 -map 0 -threads 1 "%%~nx_output_FPS25.mp4"
ffmpeg -i %%x -r 30 -vcodec libx264 -acodec copy -map_metadata 0 -map 0 -threads 1 "%%~nx_output_FPS30.mp4"
REM ffmpeg -r "60" -i %%x -vcodec copy -acodec copy -map_metadata 0 -map 0 -threads 1 "%%~nx_output_FPS60.mp4"

Video-ToGIF (ffmpeg video to GIF)

Convert video to GIF files.
By different styles:
Video-ToGIF_16Bit-Style.bat - 16 Bit-Style
Video-ToGIF_32ColorsStyle.bat - 32 Colors Style
Video-ToGIF_Fast.bat - fast&quality
Video-ToGIF_HD.bat - max quality\

Links:

http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html

Video-Cut (ffmpeg cut video)

-ss - start
ffmpeg -ss 00:01:00.000 ... - cut video from 1 minute to the end of video
-t - duration
ffmpeg -ss 00:01:00.000 -i %%x -t 00:01:00.000 ... - cut video from 1 minute to 00:02:00.000
-to - end
ffmpeg -ss 00:01:00.000 -i %%x -to 00:01:10.000 ... - cut video from 1 minute to 00:01:10.000
Write time in MAIN: ffmpeg ... By different styles:
Video-CutFast.bat - Fast
Video-CutAccurateBeta.bat - Fast&Accurate
Video-CutAccurateAndRecode.bat - Accurate&Recode
Read more about Cut&Seeking here: https://trac.ffmpeg.org/wiki/Seeking

Video-ToWebM

Convert video file to WebM
You can change -crf 0..51 - where 0 is lossless, 23 is the default, and 51 is worst quality possible.
MAIN: ffmpeg.exe -i %%x -vcodec libvpx -crf 30 -b:v 0 -acodec libvorbis "%%~nx_output_WEBM.webm"

Youtube-dl

youtube-dl-* - the ready-made presets for youtube-dl (it uses yt-dlp, now)
youtube-dl-ThumbNail.bat - it downloads only thumbnail from youtube video
youtube-dl-MP3-192Kbps.bat - it downloads mp3 file - 192Kbps it is the maximum quality of audio file in youtube audio stream

FFMPEG About 🎥

FFMPEG WebPages:

https://www.ffmpeg.org/
FFMPEG About:
Official: https://www.ffmpeg.org/about.html
Wiki: https://en.wikipedia.org/wiki/FFmpeg

YouTube-DL About 🎥

YouTube-DL WebPages:

http://rg3.github.io/youtube-dl/
YouTube-DL About:
Official: http://rg3.github.io/youtube-dl/
GitHub: https://github.com/rg3/youtube-dl

yt-dlp About 🎥

yt-dlp About WebPages:

GitHub: https://github.com/yt-dlp/yt-dlp

AtomicParsley About 🎥

AtomicParsley WebPages:

http://atomicparsley.sourceforge.net/
AtomicParsley About:
Official: https://sourceforge.net/projects/atomicparsley/
GitHub: https://github.com/wez/atomicparsley

ImageMagick About 🧙‍♂️

ImageMagick WebPages:

https://imagemagick.org
ImageMagick About:
GitHub: https://github.com/ImageMagick/ImageMagick

These links for me (and maybe for you too =) ):

srt - [https://trac.ffmpeg.org/ticket/7356]
srt EOF - sub.ass - CRLF and sub.srt - LF - [https://trac.ffmpeg.org/ticket/7362]

bat_ffmpeg's People

Contributors

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

bat_ffmpeg's Issues

batch replay gain removal

Возможно ли сделать пакетное удаление Replay Gain по этому примеру.
Конкретней, если запустить bat, то он бы пакетно удалил из всех mp3 replay gain, включая вложенные папки, а новое имя было бы точно такое же как у оригинала, ну или просто к новому имени добавлялся какой-нибудь символ, а старый удалялся

[Request] Merge video and audio

Hi! Can I request a batch file for merging video and audio to a single file using drag-and-drop? Something that will do the process like the code below. It can either be dragging both video & audio file at the same time or dragging the video first and then the audio after. I tried making my own but all attempts have been unsuccessful so far. Thank you so much!

ffmpeg -i "video.mp4" -i "audio.aac" -c copy "output.mp4"

ffmpeg IF .bat condition on channel count and language

Hi I have a .bat file to convert and change channel volume levels(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

Video AI Upscaling

@KnightDanila You're smarter than me, maybe you can figure it out.

Step 1: Output frames from video:

REM https://forum.videohelp.com/threads/344457-can-t-get-ffmpeg-to-convert-video-to-image-sequence#post2177407

ffmpeg -i %%x -r 0.10 -f image2 -s 1280x720 %%4d.jpg

Increase the -r value to get more frames.

Step 3: output photos to a folder

can't figure out

Step 4: take the folder of photos and upscale them

Can't really figure out. Only figured out how to do one image at a time:

AI Upscale single image:

Using https://github.com/nihui/realsr-ncnn-vulkan

I've found this has more realistic results than waifu2x.

realsr-ncnn-vulkan.exe -i input.jpg -o output.png -s 4

Using https://github.com/nihui/waifu2x-ncnn-vulkan

REM https://github.com/nihui/waifu2x-ncnn-vulkan#usages

REM -i is input, -o is output file, -n is noise level, -s is scale factor
REM -v is verbose output, -h is help, -x is tta mode (reduce artifacts, longer processing time)
waifu2x-ncnn-vulkan.exe -i %%x -o "%%~nx_output_ai_upscaled%%~xx" -n 1 -s 4 -v

Step 4: Convert images to video

ffmpeg -r 1/5 -i %%4d.jpg -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4
pause

To do:

  • output photos to a folder
  • automatically take the folder of photos and upscale them

Alternative software for AI upscaling video that I have tested:

https://github.com/AaronFeng753/Waifu2x-Extension-GUI

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.