Author:Mikhail Artamonov
Git clone:https://github.com/maximalisimus/url.git

Download FFMPEG.

Скачать «ffmpeg-27.06.2022-sfx.exe» c Github-Release.

Params.

«convert.bat»:

@cd/d "%~dp0"
@echo off

SET vpath=%CD%
for /R "%CD%\" %%i IN (*.mov) do (
    ffmpeg.exe -i "%vpath%\%%~ni.mov" -vcodec libx264 -acodec aac "%vpath%\%%~ni.mp4"
)

Операции подстановки ссылок на переменные команды FOR также расширены.

Допускается применение следующих синтаксических конструкций:

Example.

ffmpeg.exe -i "video.flv" -vcodec libx264 -acodec aac "video.mp4"

ffmpeg.exe -i "video.mp4" -vcodec libx264 -acodec aac "video2.mp4"

ffmpeg.exe -i "master.mkv" -vcodec libx264 -acodec aac "master.mp4"

ffmpeg.exe -i video.mp4 -b:a 192K -vn music.mp3

ffmpeg.exe -i "video.flv" -vcodec libx264 -acodec aac "video.mp4"

ffmpeg.exe -i "video.mp4" -vcodec libx264 -acodec aac "video2.mp4"

ffmpeg.exe -i 1.mp4 -b:a 192K -vn 1.mp3
-c:v mpeg4
-vcodec mpeg4

ffmpeg.exe -i 1.mp4 -i 1.mp3 -c:v copy -map 0:v:0 -map 1:a:0 ../1.mp4

«-c:v» and «-vcodec».

-c:v mpeg4

-vcodec mpeg4

«.ogg» to «.mp3».

ffmpeg.exe -i input.wav -vn -ar 44100 -ac 2 -b:a 192k output.mp3

Explanation of the used arguments in this example.

Note to see docs about bit-rate argument's differences. Because maybe that option is the most important one, as it decides the "quality" versus "output size" versus "old mp3-player compatibility".

ffmpeg.exe -i audio.ogg -acodec libmp3lame audio.mp3

Bash script.

for i in *.ogg; do ffmpeg -i "$i" -acodec libmp3lame "${i%.*}.mp3"; done

Concat «.mp3»

Example-1.

«list.txt»

file '/path/to/first.mp3'
file '/path/to/second.mp3'

Command.

ffmpeg.exe -f concat -i list.txt -c copy out.mp3

Example-2.

ffmpeg.exe -i first.mp3 -i second.mp3 -filter_complex [0:a][1:a]concat=n=2:v=0:a=1 out.mp3

Example-3.

ffmpeg.exe -i 'concat:1.mp3|2.mp3|3.mp3' -c copy output.mp3

Example-4.

Bash.

for f in *.mp3; do echo "file '$f'" >> inputs.txt; done

And command.

ffmpeg.exe -f concat -i inputs.txt -c copy output.mp3

Concat «.mp4»

Command.

ffmpeg.exe -i opening.mkv -i episode.mkv -i ending.mkv \
-filter_complex "[0:v] [0:a] [1:v] [1:a] [2:v] [2:a] \
concat=n=3:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" output.mkv

Demuxer

«mylist.txt»

file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'

Command

ffmpeg.exe -f concat -i mylist.txt -c copy output.mp4

CMD

(echo file 'first file.mp4' & echo file 'second file.mp4' )>list.txt
ffmpeg.exe -safe 0 -f concat -i list.txt -c copy output.mp4

or

(for %i in (*.mp4) do @echo file '%i') > list.txt
ffmpeg -safe 0 -f concat -i list.txt -c copy output.mp4

Concat protocol

Use this method with formats that support file-level concatenation (MPEG-1, MPEG-2 PS, DV). Do not use with MP4.

ffmpeg.exe -i "concat:input1|input2" -codec copy output.mkv

Replace audio.

ffmpeg.exe -i 1.mp4 -i 1.mp3 -c:v copy -map 0:v:0 -map 1:a:0 ../1.mp4

Copyright © 14.04.2025 by Mikhail Artamonov