From 21c2831355ca77d5469bf3d6dafc6b0c796860c9 Mon Sep 17 00:00:00 2001 From: Andrew Wason Date: Sat, 23 Dec 2023 15:31:41 -0500 Subject: [PATCH] ffmpeg presets. compare frame end to clipEnd --- src/mediafx/main.cpp | 13 +++++++++---- src/mediafx/media_clip.cpp | 2 +- tests/qmltest.sh | 4 +--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/mediafx/main.cpp b/src/mediafx/main.cpp index 7573310..a4439ea 100644 --- a/src/mediafx/main.cpp +++ b/src/mediafx/main.cpp @@ -76,15 +76,20 @@ int main(int argc, char* argv[]) QString command; if (parser.isSet(qSL("command"))) { command = parser.value(qSL("command")); - if (command == "ffplay") { + if (command == qSL("ffplay")) { // XXX need to handle audio eventually command = qSL("ffplay -autoexit -infbuf -f rawvideo -video_size ${MEDIAFX_FRAMESIZE} -pixel_format rgb0 -framerate ${MEDIAFX_FRAMERATE} -i pipe:${MEDIAFX_VIDEOFD}"); - } else if (command == "ffmpeg") { + } else if (command.startsWith(qSL("ffmpeg:"))) { if (!parser.isSet(qSL("output"))) { parser.showHelp(1); } - // XXX quicktime no longer supports qtrle - command = qSL("ffmpeg -f rawvideo -video_size ${MEDIAFX_FRAMESIZE} -pixel_format rgb0 -framerate ${MEDIAFX_FRAMERATE} -i pipe:${MEDIAFX_VIDEOFD} -f mov -vcodec rawvideo -pix_fmt uyvy422 -vtag yuvs -framerate ${MEDIAFX_FRAMERATE} -y ${MEDIAFX_OUTPUT}"); + if (command == qSL("ffmpeg:lossless")) { + command = qSL("ffmpeg -f rawvideo -video_size ${MEDIAFX_FRAMESIZE} -pixel_format rgb0 -framerate ${MEDIAFX_FRAMERATE} -i pipe:${MEDIAFX_VIDEOFD} -f nut -vcodec ffv1 -flags bitexact -g 1 -level 3 -pix_fmt rgb32 -framerate ${MEDIAFX_FRAMERATE} -fflags bitexact -y ${MEDIAFX_OUTPUT}"); + } else if (command == qSL("ffmpeg:mov")) { + command = qSL("ffmpeg -f rawvideo -video_size ${MEDIAFX_FRAMESIZE} -pixel_format rgb0 -framerate ${MEDIAFX_FRAMERATE} -i pipe:${MEDIAFX_VIDEOFD} -f mov -vcodec rawvideo -pix_fmt uyvy422 -vtag yuvs -framerate ${MEDIAFX_FRAMERATE} -y ${MEDIAFX_OUTPUT}"); + } else { + parser.showHelp(1); + } } } QString output; diff --git a/src/mediafx/media_clip.cpp b/src/mediafx/media_clip.cpp index 703fb65..57d9288 100644 --- a/src/mediafx/media_clip.cpp +++ b/src/mediafx/media_clip.cpp @@ -81,7 +81,7 @@ void MediaClip::render() if (!isActive()) return; - if (m_currentFrameTime.start() >= m_clipEnd) { + if (m_currentFrameTime.end() >= m_clipEnd) { if (m_audioTrack) m_audioTrack->stop(); if (m_videoTrack) diff --git a/tests/qmltest.sh b/tests/qmltest.sh index 5f0390f..b2d193e 100755 --- a/tests/qmltest.sh +++ b/tests/qmltest.sh @@ -35,10 +35,8 @@ for assetspec in "$@"; do "${BASE}/../tools/create-asset.sh" "${ASSETS}" ${assetspec} || exit 1 done -FFMPEG='ffmpeg -f rawvideo -video_size ${MEDIAFX_FRAMESIZE} -pixel_format rgb0 -framerate ${MEDIAFX_FRAMERATE} -i pipe:${MEDIAFX_VIDEOFD} -f nut -vcodec ffv1 -flags bitexact -g 1 -level 3 -pix_fmt rgb32 -framerate ${MEDIAFX_FRAMERATE} -fflags bitexact -y ${MEDIAFX_OUTPUT}' - echo Testing ${QML} -"${MEDIAFX}" --fps ${FRAMERATE} --size ${SIZE} --output "${OUTPUT}" --command "${FFMPEG}" "${QML}" || exit 1 +"${MEDIAFX}" --fps ${FRAMERATE} --size ${SIZE} --output "${OUTPUT}" --command "ffmpeg:lossless" "${QML}" || exit 1 "${BASE}/../tools/framehash.sh" "${OUTPUT}" > "${OUTPUT}.framehash" || exit 1 # If framehash is different, then pixel difference each frame.