이 페이지에서

QVideoFrameInput Class

QVideoFrameInput 클래스는 QMediaRecorder 에 사용자 정의 비디오 프레임을 제공하거나 QMediaCaptureSession 를 통해 비디오 출력을 생성하는 데 사용됩니다. 더 보기...

헤더: #include <QVideoFrameInput>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
다음부터: Qt 6.8
상속: QObject

공개 함수

QVideoFrameInput(QObject *parent = nullptr)
QVideoFrameInput(const QVideoFrameFormat &format, QObject *parent = nullptr)
virtual ~QVideoFrameInput() override
QMediaCaptureSession *captureSession() const
QVideoFrameFormat format() const
bool sendVideoFrame(const QVideoFrame &frame)

신호

상세 설명

QVideoFrameInput은 FFmpeg 백엔드에서만 지원됩니다.

QVideoFrameInput 와 QMediaRecorder 를 QMediaCaptureSession 에 연결하여 사용자 정의 비디오 프레임을 기록할 수 있습니다. 풀(pull) 모드 구현의 경우, readyToSendVideoFrame() 신호에 응답하여 sendVideoFrame()를 호출하십시오. 아래 코드 예제에서는 이 작업을 사용자 정의 미디어 생성기 클래스의 슬롯에 신호를 연결하여 수행합니다. 슬롯 함수는 새로운 비디오 프레임을 포함하는 또 다른 신호를 발생시키며, 이 신호는 sendVideoFrame()에 연결됩니다:

QMediaCaptureSession session;
QMediaRecorder recorder;
QVideoFrameInput videoInput;

session.setRecorder(&recorder);
session.setVideoFrameInput(&videoInput);

MediaGenerator generator; // Custom class providing video frames

connect(&videoInput, &QVideoFrameInput::readyToSendVideoFrame,
        &generator, &MediaGenerator::nextVideoFrame);
connect(&generator, &MediaGenerator::videoFrameReady,
        &videoInput, &QVideoFrameInput::sendVideoFrame);

recorder.record();

다음은 비디오 프레임을 제공하는 슬롯 함수의 최소 구현 예시입니다:

void MediaGenerator::nextVideoFrame()
{
    QVideoFrame frame = nextFrame();
    emit videoFrameReady(frame);
}

자세한 내용은 readyToSendVideoFrame() 및 sendVideoFrame()을 참조하십시오.

QMediaRecorder, QMediaCaptureSession, QVideoSink도 참조하십시오 .

멤버 함수 문서

[explicit] QVideoFrameInput::QVideoFrameInput(QObject *parent = nullptr)

parent 를 사용하여 새로운 QVideoFrameInput 객체를 생성합니다.

[explicit] QVideoFrameInput::QVideoFrameInput(const QVideoFrameFormat &format, QObject *parent = nullptr)

비디오 프레임 format 및 parent 을 사용하여 새로운 QVideoFrameInput 객체를 생성합니다.

지정된 format 는 QMediaRecorder::record()를 호출할 때 해당 비디오 인코더를 초기화하는 데 참고 정보로 사용됩니다. 형식이 지정되지 않았거나 유효하지 않은 경우, 첫 번째 프레임을 전송할 때 비디오 인코더가 초기화됩니다. 해당 비디오 인코더가 초기화된 후 다른 픽셀 형식과 크기를 가진 비디오 프레임을 전송하면 녹화 중 성능 저하가 발생할 수 있습니다.

전송할 프레임의 종류를 미리 알고 있는 경우, 포맷을 지정하는 것이 좋습니다.

[override virtual noexcept] QVideoFrameInput::~QVideoFrameInput()

객체를 삭제합니다.

QMediaCaptureSession *QVideoFrameInput::captureSession() const

이 비디오 프레임 입력이 연결된 캡처 세션을 반환하거나, 비디오 프레임 입력이 캡처 세션에 연결되어 있지 않은 경우 ` nullptr `를 반환합니다.

QMediaCaptureSession::setVideoFrameInput()를 사용하여 비디오 프레임 입력을 세션에 연결하십시오.

QVideoFrameFormat QVideoFrameInput::format() const

비디오 프레임 입력 객체 생성 시 지정된 비디오 프레임 형식을 반환합니다.

[signal] void QVideoFrameInput::readyToSendVideoFrame()

비디오 프레임 입력으로 새로운 프레임을 전송할 수 있음을 알리는 신호입니다. 이 신호를 수신한 후, 전송할 프레임이 있다면 ` sendVideoFrame `를 한 번 호출하거나, ` false`가 반환될 때까지 루프를 통해 반복해서 호출하십시오.

sendVideoFrame()도 참조하십시오 .

bool QVideoFrameInput::sendVideoFrame(const QVideoFrame &frame)

QVideoFrame 를 QMediaRecorder 로 전송하거나, QMediaCaptureSession 를 통해 비디오를 출력합니다.

지정된 frame 가 대상에 성공적으로 전송된 경우 true 를 반환합니다. 프레임이 전송되지 않은 경우 false 를 반환합니다. 이는 인스턴스가 QMediaCaptureSession 에 할당되지 않았거나, 세션에 비디오 출력 또는 미디어 레코더가 없거나, 미디어 레코더가 시작되지 않았거나, 미디어 레코더의 큐가 가득 찬 경우에 발생할 수 있습니다. 대상이 새 프레임을 처리할 수 있게 되는 즉시 readyToSendVideoFrame 신호가 전송됩니다.

빈 비디오 프레임의 전송은 QMediaRecorder 에 의해 입력 스트림의 종료로 처리됩니다. QMediaRecorder 는 QMediaRecorder::autoStop 가 true 이고 모든 입력에서 스트림 종료가 보고된 경우 녹화를 자동으로 중지합니다.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.