Closed Toshea111 closed 2 years ago
@Toshea111 I cannot test with Windows 7 so I can't reproduce the bug. It looks like an issue with ffmpeg. What's the version of ROpenCVLite on your system?
I suggest that you start by upgrading ffmpeg to its latest version on your system. Then recompile OpenCV with ROpenCVLite::installOpenCV()
(say yes when prompted) and reinstall Rvision (remotes::install_github("swarm-lab/Rvision", force = TRUE)
) and trackR (remotes::install_github("swarm-lab/trackR", force = TRUE)
).
I am using ROpenCVLite 4.60.02, and have now upgraded ffmpeg to version 5.0. I was able to successfully recompile OpenCV and Rvision, however upon attempting to reinstall trackR, I received the following error message:
Downloading GitHub repo swarm-lab/trackR@HEAD Error in utils::download.file(url, path, method = method, quiet = quiet, : download from 'https://api.github.com/repos/swarm-lab/trackR/tarball/HEAD' failed
I have also tried installing on Windows 10 Enterprise, and encounter the same issue.
@Toshea111 It looks like the download of the package from Github is timing out (slow internet?). You can increase the time out time by setting options(timeout=120)
(for 120 seconds; increase the number as needed).
FYI, this is a problem that is not related to the original question. It is better to create a separate issue for each problem/question to help future users find answers if they run into similar problems.
Thank you, that solved the download issue, however upon trying to export the tracked video, I again encountered this error:
[libopenh264 @ 00000136c8849800] Incorrect library version loaded [ERROR:0@47.568] global /build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2985) open Could not open codec libopenh264, error: Unspecified error (-22) [ERROR:0@47.568] global /build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (3002) open VIDEOIO/FFMPEG: Failed to initialize VideoWriter Warning: Error in new_CppObject_xp: Could not open the output. 2: shiny::runApp 1: trackPlayer
Those last two lines were not present before, but the rest seems to be the same.
Apologies for the issue mixing, I will keep this thread focussed on the above problem, as you suggest.
@Toshea111 It looks like you're missing the OpenH264 codec in your ffmpeg installation. I'm not sure how to resolve that on Windows 7 but if you figure it out, you may need to recompile OpenCV (ROpenCVLite::installOpenCV()
) to make it available to trackR.
Another option (until I can find the time to code a more comprehensive fix) is to modify:
vw <- videoWriter(theTrackVideoPath(),
fourcc = "avc1", <----- THIS LINE
fps = theVideo()$fps(),
height = theVideo()$nrow(),
width = theVideo()$ncol())
in https://github.com/swarm-lab/trackR/blob/master/inst/modules/trackPlayer/playServer.R so that the fourcc corresponds to a codec available on your system.
Thank you, that fixed the issue. For future reference, I did the following:
Opened the folder:
trackR\modules\trackPlayer
Opened the file:
playServer
Made the modification:
vw <- videoWriter(theTrackVideoPath(), fourcc = "FMP4", fps = theVideo()$fps(), height = theVideo()$nrow(), width = theVideo()$ncol())
Specifically, I replaced the codec avc1
with FMP4
which came with the ROpenCVLite
package.
Thank you again for taking the time to help, hopefully this will be useful to other users that experience the issue.
@Toshea111 Thanks for the walkthrough. If I can find the time, I'll try to implement a solution to automatically select the "best" available codec on a user's machine, but that might not be before several weeks (months?).
Describe the bug When attempting to export a tracked video in trackPlayer, I am met with the following error message:
Failed to load OpenH264 library: openh264-1.8.0-win64.dll Please check environment and/or download library: https://github.com/cisco/openh264/releases
[libopenh264 @ 0000020b72c9e2c0] Incorrect library version loaded [ERROR:0@14.555] global /build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2985) open Could not open codec libopenh264, error: Unspecified error (-22) [ERROR:0@14.555] global /build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (3002) open VIDEOIO/FFMPEG: Failed to initialize VideoWriter Warning: Error in new_CppObject_xp: Could not open the output. [No stack trace available]
I have been able to download the openh264-1.8.0-win64.dll file, but cannot find the correct directory to deposit it in.
Computer (please complete the following information):
R (please complete the following information):
Additional context Add any other context about the problem here.