-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve audio concat; cleanup temp files; add -T(temp_dir) and -P (video_pool_size) args #1
Open
vvd170501
wants to merge
3
commits into
debnatkh:main
Choose a base branch
from
vvd170501:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Проверял с ffmpeg 4.4.2-0ubuntu0.22.04.1, количество используемых потоков равно кол-ву физических ядер процессора.
Запуск нескольких одновременно выполняющихся процессов ffmpeg не улучшает производительность, а наоборот, немного ухудшает её.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Относится только к предпоследней стадии - trim+concat для каждого чанка.
Для разделения видео и аудио потоков и обработки аудио в каждом чанке используется 1 поток, поэтому на этих этапах нет проблем с параллельным исполнением.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Спасибо
Тоже хотел протестить, но никак не доходили руки
Кажется, когда добавлял эту опцию, тестил и использование многопоточности было оправданным
Сам ещё побенчмаркаю
ffmpeg по дефолту запускается с опцией threads=-1, поэтому звучит правдоподобно, что процесс будет занимать все ядра и будет конкурировать с другими
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vvd170501, а какой порядок улучшений времени? Остались результаты замеров?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Замерил на 30 минутах лекции в качестве 1080p60.
CPU - Ryzen 7 5800HS (8 физических ядер).
Разбиение на чанки и обработка аудио во всех случаях занимали ~8 секунд.
С одним процессом ffmpeg (5a04dcc):
$ time ./main.py -s 150 -m 50 -n 8 -p 8 -T /tmp/ramdisk/ -i ls4_30min.mkv -o lec4_trimmed.mkv real 6m10,282s user 50m56,566s sys 0m46,125s
Во время выполнения trim+concat каждое из 16 логических ядер используется на ~50%, ffmpeg использует ~1 ГБ памяти, load average (1min) ~=9.
С 8 параллельными процессами ffmpeg (c9bc294):
$ time ./main.py -s 150 -m 50 -n 8 -p 8 -T /tmp/ramdisk/ -i lec4_30min.mkv -o lec4_trimmed.mkv real 7m25,505s user 110m17,434s sys 1m48,683s
Все логические ядра загружены на 100%, используется 8 ГБ памяти, load average (1min) ~=70.
C ускорением на RTX 3060 mobile (мб попробую сделать PR, но нужно как-то добавить проверку на доступность nvenc):
$ time ./main.py -s 150 -m 50 -n 8 -p 8 -P 2 -T /tmp/ramdisk/ -i lec4_30min.mkv -o lec4_trimmed.mkv real 2m22,735s user 2m0,605s sys 0m8,618s