alicevision / AliceVision

Photogrammetric Computer Vision Framework
http://alicevision.org
Other
2.99k stars 824 forks source link

aliceVision_utils_keyframeSelection-2.0 does not work #852

Closed xzhub closed 3 years ago

xzhub commented 4 years ago

Trying to generate images from video under Linux. Unzipped the latest version(2019.2.0) into /tmp/bin/Meshroom-2019.2.0, the command failed with 'Unable to open the video'

$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/bin/Meshroom-2019.2.0/aliceVision/lib \
    /tmp/bin/Meshroom-2019.2.0/aliceVision/bin/aliceVision_utils_keyframeSelection-2.0 \
    --sensorDbPath /tmp/bin/Meshroom-2019.2.0/aliceVision/share/aliceVision/cameraSensors.db \
    --voctreePath /tmp/bin/Meshroom-2019.2.0/aliceVision/share/aliceVision/vlfeat_K80L3.SIFT.tree \
    --outputFolder /tmp/20200804-234606-00dcdd81-7cda-4731-8024-1724533ab260_video_img \
    --mediaPaths /tmp/file_example_MP4_640_3MG.mp4
Program called with the following parameters:
 * brands =  = [] (default)
 * frameOffsets =  Unknown Type "St6vectorIjSaIjEE" (default)
 * maxFrameStep =  Unknown Type "j" (default)
 * maxNbOutFrame =  Unknown Type "j" (default)
 * mediaPaths =  = [/tmp/file_example_MP4_640_3MG.mp4]
 * minFrameStep =  Unknown Type "j" (default)
 * mmFocals =  Unknown Type "St6vectorIfSaIfEE" (default)
 * models =  = [] (default)
 * outputFolder = "/tmp/20200804-234606-00dcdd81-7cda-4731-8024-1724533ab260_video_img"
 * pxFocals =  Unknown Type "St6vectorIfSaIfEE" (default)
 * sensorDbPath = "/tmp/bin/Meshroom-2019.2.0/aliceVision/share/aliceVision/cameraSensors.db"
 * sharpSubset =  Unknown Type "j" (default)
 * sharpnessPreset = "normal" (default)
 * sparseDistMaxScore = 100 (default)
 * useSharpnessSelection = 1 (default)
 * useSparseDistanceSelection = 1 (default)
 * verboseLevel = "info" (default)
 * voctreePath = "/tmp/bin/Meshroom-2019.2.0/aliceVision/share/aliceVision/vlfeat_K80L3.SIFT.tree"

[00:23:06.434282][info] Single camera
[00:23:06.434438][info] camera: /tmp/file_example_MP4_640_3MG.mp4
     - brand:
     - model:
     - focal (mm): 0
     - focal (px): 0
     - frame offset: 0

[00:23:06.619154][info] vocabulary tree loaded with :
    - 3 levels
    - 80 branching factor

[00:23:06.639338][info] Supported CUDA-Enabled GPU detected.
[00:23:06.641012][warning] Unable to open the video : /tmp/file_example_MP4_640_3MG.mp4
terminate called after throwing an instance of 'std::invalid_argument'
  what():  Unable to open the video : /tmp/file_example_MP4_640_3MG.mp4
Aborted

$ file /tmp/file_example_MP4_640_3MG.mp4
/tmp/file_example_MP4_640_3MG.mp4: ISO Media, MP4 v2 [ISO 14496-14]

Is this a bug?

fabiencastan commented 4 years ago

The binary release does not include opencv for now, which is used to load videos. It will be included in the coming release.

xzhub commented 4 years ago

With the latest version, I am still seeing a similar error

[22:08:13.503053][info] Single camera
[22:08:13.503127][info] camera: /tmp/video/file_example_MP4_1280_10MG.mp4
     - brand:
     - model:
     - focal (mm): 0
     - focal (px): 0
     - frame offset: 0

 * brands =  = [] (default)
 * frameOffsets =  Unknown Type "St6vectorIjSaIjEE" (default)
 * maxFrameStep =  Unknown Type "j"
 * maxNbOutFrame =  Unknown Type "j" (default)
 * mediaPaths =  = [/tmp/video/file_example_MP4_1280_10MG.mp4]
 * minFrameStep =  Unknown Type "j"
 * mmFocals =  Unknown Type "St6vectorIfSaIfEE" (default)
 * models =  = [] (default)
 * outputFolder = "/tmp/video/"
 * pxFocals =  Unknown Type "St6vectorIfSaIfEE" (default)
 * sensorDbPath = "/opt/Meshroom-2020.1.0/aliceVision/share/aliceVision/cameraSensors.db"
 * sharpSubset =  Unknown Type "j" (default)
 * sharpnessPreset = "normal" (default)
 * sparseDistMaxScore = 100 (default)
 * useSharpnessSelection = 1 (default)
 * useSparseDistanceSelection = 1 (default)
 * verboseLevel = "info" (default)
 * voctreePath = "/opt/Meshroom-2020.1.0/aliceVision/share/aliceVision/vlfeat_K80L3.SIFT.tree"

[22:08:13.640463][info] vocabulary tree loaded with :
    - 3 levels
    - 80 branching factor

[22:08:13.664802][info] Supported CUDA-Enabled GPU detected.
[22:08:13.666548][warning] Unable to open the video : /tmp/video/file_example_MP4_1280_10MG.mp4
[22:08:13.674592][fatal] Unable to open the video : /tmp/video/file_example_MP4_1280_10MG.mp4

Video clip downloaded from https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_1280_10MG.mp4

I also tried to convert some other videos to mpeg, avi, mkv, mov. but none of them worked. all errored out as "Unable to open the video"

xzhub commented 4 years ago

Tried installing opencv in my centos system and run that command again, but got the same error.

xzhub commented 4 years ago

These are the opencv I've installed to the system:

# rpm -qa|grep opencv
opencv-core-3.4.6-5.el8.x86_64
opencv-3.4.6-5.el8.x86_64
opencv-contrib-3.4.6-5.el8.x86_64

I am running with centos 8.

The meshroom version is the latest 2020.1.0

xzhub commented 4 years ago

The official docker seems have the same issue( I am using the 2019 version since the 2020 is not released yet)

$ docker run -i --rm  -v /tmp:/tmp --gpus all alicevision/meshroom:2019.2.0-centos7-cuda8.0  /opt/AliceVision_install/bin/aliceVision_utils_keyframeSelection  --sensorDbPath /opt/AliceVision_install/share/aliceVision/cameraSensors.db --voctreePath /opt/Meshroom_bundle/aliceVision/share/aliceVision/vlfeat_K80L3.SIFT.tree --mediaPaths /tmp/video/file_example_MP4_1280_10MG.mp4 --outputFolder /tmp
Program called with the following parameters:
 * brands =  = [] (default)
 * frameOffsets =  Unknown Type "St6vectorIjSaIjEE" (default)
 * maxFrameStep =  Unknown Type "j" (default)
 * maxNbOutFrame =  Unknown Type "j" (default)
 * mediaPaths =  = [/tmp/video/file_example_MP4_1280_10MG.mp4]
 * minFrameStep =  Unknown Type "j" (default)
 * mmFocals =  Unknown Type "St6vectorIfSaIfEE" (default)
 * models =  = [] (default)
 * outputFolder = "/tmp"
 * pxFocals =  Unknown Type "St6vectorIfSaIfEE" (default)
 * sensorDbPath = "/opt/AliceVision_install/share/aliceVision/cameraSensors.db"
 * sharpSubset =  Unknown Type "j" (default)
 * sharpnessPreset = "normal" (default)
 * sparseDistMaxScore = 100 (default)
 * useSharpnessSelection = 1 (default)
 * useSparseDistanceSelection = 1 (default)
 * verboseLevel = "info" (default)
 * voctreePath = "/opt/Meshroom_bundle/aliceVision/share/aliceVision/vlfeat_K80L3.SIFT.tree"

[21:44:10.716249][info] Single camera
[21:44:10.716348][info] camera: /tmp/video/file_example_MP4_1280_10MG.mp4
     - brand:
     - model:
     - focal (mm): 0
     - focal (px): 0
     - frame offset: 0

[21:44:10.856795][info] vocabulary tree loaded with :
    - 3 levels
    - 80 branching factor

[21:44:10.880959][info] Supported CUDA-Enabled GPU detected.
[21:44:10.884277][warning] Unable to open the video : /tmp/video/file_example_MP4_1280_10MG.mp4
terminate called after throwing an instance of 'std::invalid_argument'
  what():  Unable to open the video : /tmp/video/file_example_MP4_1280_10MG.mp4

Is there any easy way that I can run aliceVision_utils_keyframeSelection in command line? Thanks.

natowi commented 4 years ago

I´m on windows and the video works for me (I had to disable Use sparse/Use sharp though to get some frames). So we know there is no issue with the file itself.

xzhub commented 4 years ago

@natowi I've seen some comments that people say the windows version works but seems no one mentioned about the linux version. Maybe it's a linux specific issue?

Could you please verify if it is something wrong on my computer or it does not work on your side either?

natowi commented 4 years ago

Sorry, I don´t have access to a linux machine at the moment to test this.

xzhub commented 4 years ago

Totally understood, just like it's always difficult for me to find a window server to run any test. When trying to save the graph file out, I have to install a windows trial version virtual machine and bear with its slowness. I think the current version has a command-line option to save the graph file, which is great. Back to this topic, since I've tested the command line directly and the official docker, it looks to me an issue of software packing, or at least misleading error prompt. There is definitely something wrong, but it could be a simple tweak to make it run again.

natowi commented 4 years ago

In the meantime you could use the ffmpeg tool to extract frames. It does not have the blur detection and auto-metadata like the Meshroom tool but everything else is similar.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.