RaidenVideoRipper

Форк
0
/
videoprocessor.cpp 
48 строк · 996.0 Байт
1
#include "videoprocessor.h"
2

3
extern "C" {
4
#include <dullahan_ffmpeg.h>
5
}
6

7
#include <QDebug>
8

9
VideoProcessor::VideoProcessor(
10
    const int startPosition,
11
    const int endPosition,
12
    const QString& videoPath,
13
    const QString& outputVideoPath
14
)
15
: startPosition(startPosition),
16
endPosition(endPosition),
17
videoPath(videoPath),
18
outputVideoPath(outputVideoPath)
19
{
20
}
21

22
void VideoProcessor::cancel()
23
{
24
    dullahan_ffmpeg_cancel();
25
}
26

27
void VideoProcessor::run()
28
{
29
    auto arguments = std::vector<std::string> {
30
        "ffmpeg",
31
        "-y",
32
        "-i",
33
        videoPath.toStdString(),
34
        "-ss",
35
        std::to_string(startPosition) + "ms",
36
        "-to",
37
        std::to_string(endPosition) + "ms",
38
        outputVideoPath.toStdString()
39
    };
40

41
    std::vector<char*> argv;
42
    for (const auto& arg : arguments) {
43
        argv.push_back(const_cast<char*>(arg.c_str()));
44
    }
45

46
    auto result = dullahan_ffmpeg_main(argv.size(), argv.data());
47
    emit videoProcessingDidFinish(result);
48
}
49

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.