.exe file fails to read a VideoStream from a camera connected via rtsp?










0















I have a little project that should read VideosStream from rtsp camera to do some other tasks. I could run its original hc_yolo_all.py file without any issue. However, after making an executable file with pyinstaller --onefile hc_yolo_all.py, it couldn't derive VideoStream and gave the error



 Traceback (most recent call last):
File "hc_yolo_all.py", line 60, in <module>
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmodulesimgprocsrcresize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

[7340] Failed to execute script hc_yolo_all.


It is seen that frame = cv2.resize(frame, (416,416)), line 60, of hc_yolo_all.py is receiving an empty frame and therefore, output an error.



Where do you think the issue lies in?



I, to be honest, don't know whether it is related to opencv or rtsp or pyinstaller, so I've tagged those three.










share|improve this question






















  • You might just implement a simple if statement that applies cv2.resize only if received frame is not empty? This way you would be able to get all the rtsp VideoStream ignoring the empty incoming frames

    – Loss of human identity
    Nov 14 '18 at 9:25











  • @Employee, good point, but I mentioned I could run a program without any issue when I directly used .py file itself. Otherwise I wouldn't be able to do that. I tend to think that .exe file can't get access to the provided rtsp address

    – voo_doo
    Nov 15 '18 at 4:49















0















I have a little project that should read VideosStream from rtsp camera to do some other tasks. I could run its original hc_yolo_all.py file without any issue. However, after making an executable file with pyinstaller --onefile hc_yolo_all.py, it couldn't derive VideoStream and gave the error



 Traceback (most recent call last):
File "hc_yolo_all.py", line 60, in <module>
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmodulesimgprocsrcresize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

[7340] Failed to execute script hc_yolo_all.


It is seen that frame = cv2.resize(frame, (416,416)), line 60, of hc_yolo_all.py is receiving an empty frame and therefore, output an error.



Where do you think the issue lies in?



I, to be honest, don't know whether it is related to opencv or rtsp or pyinstaller, so I've tagged those three.










share|improve this question






















  • You might just implement a simple if statement that applies cv2.resize only if received frame is not empty? This way you would be able to get all the rtsp VideoStream ignoring the empty incoming frames

    – Loss of human identity
    Nov 14 '18 at 9:25











  • @Employee, good point, but I mentioned I could run a program without any issue when I directly used .py file itself. Otherwise I wouldn't be able to do that. I tend to think that .exe file can't get access to the provided rtsp address

    – voo_doo
    Nov 15 '18 at 4:49













0












0








0








I have a little project that should read VideosStream from rtsp camera to do some other tasks. I could run its original hc_yolo_all.py file without any issue. However, after making an executable file with pyinstaller --onefile hc_yolo_all.py, it couldn't derive VideoStream and gave the error



 Traceback (most recent call last):
File "hc_yolo_all.py", line 60, in <module>
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmodulesimgprocsrcresize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

[7340] Failed to execute script hc_yolo_all.


It is seen that frame = cv2.resize(frame, (416,416)), line 60, of hc_yolo_all.py is receiving an empty frame and therefore, output an error.



Where do you think the issue lies in?



I, to be honest, don't know whether it is related to opencv or rtsp or pyinstaller, so I've tagged those three.










share|improve this question














I have a little project that should read VideosStream from rtsp camera to do some other tasks. I could run its original hc_yolo_all.py file without any issue. However, after making an executable file with pyinstaller --onefile hc_yolo_all.py, it couldn't derive VideoStream and gave the error



 Traceback (most recent call last):
File "hc_yolo_all.py", line 60, in <module>
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmodulesimgprocsrcresize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

[7340] Failed to execute script hc_yolo_all.


It is seen that frame = cv2.resize(frame, (416,416)), line 60, of hc_yolo_all.py is receiving an empty frame and therefore, output an error.



Where do you think the issue lies in?



I, to be honest, don't know whether it is related to opencv or rtsp or pyinstaller, so I've tagged those three.







pyinstaller rtsp cv2 opencv-python






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 8:14









voo_doovoo_doo

143115




143115












  • You might just implement a simple if statement that applies cv2.resize only if received frame is not empty? This way you would be able to get all the rtsp VideoStream ignoring the empty incoming frames

    – Loss of human identity
    Nov 14 '18 at 9:25











  • @Employee, good point, but I mentioned I could run a program without any issue when I directly used .py file itself. Otherwise I wouldn't be able to do that. I tend to think that .exe file can't get access to the provided rtsp address

    – voo_doo
    Nov 15 '18 at 4:49

















  • You might just implement a simple if statement that applies cv2.resize only if received frame is not empty? This way you would be able to get all the rtsp VideoStream ignoring the empty incoming frames

    – Loss of human identity
    Nov 14 '18 at 9:25











  • @Employee, good point, but I mentioned I could run a program without any issue when I directly used .py file itself. Otherwise I wouldn't be able to do that. I tend to think that .exe file can't get access to the provided rtsp address

    – voo_doo
    Nov 15 '18 at 4:49
















You might just implement a simple if statement that applies cv2.resize only if received frame is not empty? This way you would be able to get all the rtsp VideoStream ignoring the empty incoming frames

– Loss of human identity
Nov 14 '18 at 9:25





You might just implement a simple if statement that applies cv2.resize only if received frame is not empty? This way you would be able to get all the rtsp VideoStream ignoring the empty incoming frames

– Loss of human identity
Nov 14 '18 at 9:25













@Employee, good point, but I mentioned I could run a program without any issue when I directly used .py file itself. Otherwise I wouldn't be able to do that. I tend to think that .exe file can't get access to the provided rtsp address

– voo_doo
Nov 15 '18 at 4:49





@Employee, good point, but I mentioned I could run a program without any issue when I directly used .py file itself. Otherwise I wouldn't be able to do that. I tend to think that .exe file can't get access to the provided rtsp address

– voo_doo
Nov 15 '18 at 4:49












1 Answer
1






active

oldest

votes


















0














Well, I could find a solution to my own question. It looks like we need to have a opencv_ffmpegxx.dll alongside with the .exe file. Here, xx should be the version of opencv when the .py was being made .exe. My opencv version was 3.4.3 (even Error is showing above), therefore, I put opencv_ffmpeg343_64.dll next to my .exe.



How to find corresponding dll: Look for the C:UsersusernameAnaconda3envsenvnameLibsite-packagescv2/ in case of using Anaconda.



Credits to this






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295631%2fexe-file-fails-to-read-a-videostream-from-a-camera-connected-via-rtsp%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Well, I could find a solution to my own question. It looks like we need to have a opencv_ffmpegxx.dll alongside with the .exe file. Here, xx should be the version of opencv when the .py was being made .exe. My opencv version was 3.4.3 (even Error is showing above), therefore, I put opencv_ffmpeg343_64.dll next to my .exe.



    How to find corresponding dll: Look for the C:UsersusernameAnaconda3envsenvnameLibsite-packagescv2/ in case of using Anaconda.



    Credits to this






    share|improve this answer



























      0














      Well, I could find a solution to my own question. It looks like we need to have a opencv_ffmpegxx.dll alongside with the .exe file. Here, xx should be the version of opencv when the .py was being made .exe. My opencv version was 3.4.3 (even Error is showing above), therefore, I put opencv_ffmpeg343_64.dll next to my .exe.



      How to find corresponding dll: Look for the C:UsersusernameAnaconda3envsenvnameLibsite-packagescv2/ in case of using Anaconda.



      Credits to this






      share|improve this answer

























        0












        0








        0







        Well, I could find a solution to my own question. It looks like we need to have a opencv_ffmpegxx.dll alongside with the .exe file. Here, xx should be the version of opencv when the .py was being made .exe. My opencv version was 3.4.3 (even Error is showing above), therefore, I put opencv_ffmpeg343_64.dll next to my .exe.



        How to find corresponding dll: Look for the C:UsersusernameAnaconda3envsenvnameLibsite-packagescv2/ in case of using Anaconda.



        Credits to this






        share|improve this answer













        Well, I could find a solution to my own question. It looks like we need to have a opencv_ffmpegxx.dll alongside with the .exe file. Here, xx should be the version of opencv when the .py was being made .exe. My opencv version was 3.4.3 (even Error is showing above), therefore, I put opencv_ffmpeg343_64.dll next to my .exe.



        How to find corresponding dll: Look for the C:UsersusernameAnaconda3envsenvnameLibsite-packagescv2/ in case of using Anaconda.



        Credits to this







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 '18 at 3:02









        voo_doovoo_doo

        143115




        143115





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295631%2fexe-file-fails-to-read-a-videostream-from-a-camera-connected-via-rtsp%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

            Museum of Modern and Contemporary Art of Trento and Rovereto