Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Showing stream video
QtWS25 Last Chance

Showing stream video

Scheduled Pinned Locked Moved Solved General and Desktop
30 Posts 4 Posters 3.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS SGaist

    In that case, I would rather consider using VLC and its Qt integration to handle the video stream.

    B Offline
    B Offline
    BrMisha
    wrote on last edited by
    #7

    @SGaist but why this solution better of using system codecs?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #8

      Because VLC is the Swiss Army Knife of vidéo decoding and supports a larger palette of codecs than most OSs provide out of the box.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      0
      • SGaistS SGaist

        Because VLC is the Swiss Army Knife of vidéo decoding and supports a larger palette of codecs than most OSs provide out of the box.

        B Offline
        B Offline
        BrMisha
        wrote on last edited by BrMisha
        #9

        @SGaist I would't like to use VLC but you have convinced me)))
        Tomorrow i will try to build VLC for windows

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #10

          There's likely already a prebuilt package.

          See also VLC-Qt

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          B 1 Reply Last reply
          0
          • SGaistS SGaist

            There's likely already a prebuilt package.

            See also VLC-Qt

            B Offline
            B Offline
            BrMisha
            wrote on last edited by
            #11

            @SGaist is VLC-Qt still actuality now? Last commit was in 2016 year and based on VLC 2.2.4

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #12

              It does not mean it does not work anymore. I'd say it's worth a try.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • B Offline
                B Offline
                BrMisha
                wrote on last edited by
                #13

                Unfortunately, VLC doesn't provide prebuilt packages for my compiler (MinGW32-64 7.3.0).
                After googling i decided to try ffmpeg. I build it following this manual https://ffmpeg.org/platform.html#Native-Windows-compilation-using-MinGW-or-MinGW_002dw64 , then add libs to *pro file:

                LIBS += -LF:/FFmpeg/tempinstall/usr/local/lib/ -llibavcodec.dll -llibavformat.dll
                INCLUDEPATH += F:/FFmpeg/tempinstall/usr/local/include
                DEPENDPATH += F:/FFmpeg/tempinstall/usr/local/include
                

                and i called avformat_open_input(some args). But got error^

                c:/qt/qt5.14.1/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: main.o: in function `qMain(int, char**)':
                D:\projects_test\qt\PlayerVideo\build-PlayerVideo-Desktop-Debug/../PlayerVideo/main.cpp:58: undefined reference to `avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)'
                

                So, i'm searching my mistake... I compared compiler versions between msys2 and qt, booth have GNU Make 4.2.1, but msys2 has gcc 8.3.0 and qt has 7.3.0.
                That is problem?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  It's "-lavcodec"

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  B 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    It's "-lavcodec"

                    B Offline
                    B Offline
                    BrMisha
                    wrote on last edited by
                    #15

                    @SGaist no, it isn't helpfull((

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #16

                      Did you fix all libraries name ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      B 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Did you fix all libraries name ?

                        B Offline
                        B Offline
                        BrMisha
                        wrote on last edited by BrMisha
                        #17

                        @SGaist this part of .pro

                        LIBS += -LF:/Musor/FFmpeg_linbuild/ffmpeg/lib/ -lavformat
                        
                        INCLUDEPATH += F:/Musor/FFmpeg_linbuild/ffmpeg/include
                        DEPENDPATH += F:/Musor/FFmpeg_linbuild/ffmpeg/include
                        

                        In code i'm calling only avformat_license(), which locates in avformat

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #18

                          Do you have ffmpeg built for the same architecture as your Qt version ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          B 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Do you have ffmpeg built for the same architecture as your Qt version ?

                            B Offline
                            B Offline
                            BrMisha
                            wrote on last edited by
                            #19

                            @SGaist yes, booth is x64

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              BrMisha
                              wrote on last edited by
                              #20

                              Men, I really don't understand what is happening.
                              I installed msys2, and some packages for that, then i copied *c:\Qt\Qt5.14.2\Tools\mingw730_64* to *c:\msys64\mingw64*.
                              Then built libav (it is "small" version of FFmpeg) and got this files:

                              build\usr\local\bin\avcodec.lib
                              build\usr\local\bin\avcodec-58.dll
                              build\usr\local\bin\avconv.exe
                              build\usr\local\bin\avdevice.lib
                              build\usr\local\bin\avdevice-57.dll
                              build\usr\local\bin\avfilter.lib
                              build\usr\local\bin\avfilter-7.dll
                              build\usr\local\bin\avformat.lib
                              build\usr\local\bin\avformat-58.dll
                              build\usr\local\bin\avprobe.exe
                              build\usr\local\bin\avresample.lib
                              build\usr\local\bin\avresample-4.dll
                              build\usr\local\bin\avutil.lib
                              build\usr\local\bin\avutil-56.dll
                              build\usr\local\bin\swscale.lib
                              build\usr\local\bin\swscale-5.dll
                              
                              build\usr\local\include\libavcodec\	<< here is *.h
                              build\usr\local\include\libavdevice\	<< here is *.h
                              build\usr\local\include\libavfilter\	<< here is *.h
                              build\usr\local\include\libavformat\	<< here is *.h
                              build\usr\local\include\libavresample\	<< here is *.h
                              build\usr\local\include\libavutil\	<< here is *.h
                              build\usr\local\include\libswscale\	<< here is *.h
                              
                              build\usr\local\lib\pkgconfig\
                              build\usr\local\lib\avcodec-58.def
                              build\usr\local\lib\avdevice-57.def
                              build\usr\local\lib\avfilter-7.def
                              build\usr\local\lib\avformat-58.def
                              build\usr\local\lib\avresample-4.def
                              build\usr\local\lib\avutil-56.def
                              build\usr\local\lib\libavcodec.dll.a
                              build\usr\local\lib\libavdevice.dll.a
                              build\usr\local\lib\libavfilter.dll.a
                              build\usr\local\lib\libavformat.dll.a
                              build\usr\local\lib\libavresample.dll.a
                              build\usr\local\lib\libavutil.dll.a
                              build\usr\local\lib\libswscale.dll.a
                              build\usr\local\lib\swscale-5.def
                              

                              *c:\Qt\Qt5.14.2\Tools\mingw730_64* was added to PATH. When I start, for example, avconv.exe, it works ok, so definitely libav was built with true mingw (which uses qt).
                              Next, i added to *.pro (using "Add library...") this:

                              win32: LIBS += -LF:/Musor/libav/build/usr/local/lib/ -llibavformat.dll
                              INCLUDEPATH += F:/Musor/libav/build/usr/local/include
                              DEPENDPATH += F:/Musor/libav/build/usr/local/include
                              

                              main.c:

                              #include <libavformat/avformat.h>
                              int main(int argc, char *argv[]) {
                              	avformat_license();
                              	return 0;
                              }
                              

                              After compilation i got:

                              C:/Qt/Qt5.14.2/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug
                              mingw32-make[1]: Entering directory 'D:/projects_test/qt/qt_test/build-qt_test-Desktop_Qt_5_14_2_MinGW_64_bit-Debug'
                              g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_SERIALPORT_LIB -DQT_CORE_LIB -I..\qt_test -I. -IF:\Musor\libav\build\usr\local\include -IC:\Qt\Qt5.14.2\5.14.2\mingw73_64\include -IC:\Qt\Qt5.14.2\5.14.2\mingw73_64\include\QtSerialPort -IC:\Qt\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Idebug -IC:\Qt\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++  -o debug\main.o ..\qt_test\main.cpp
                              ..\qt_test\main.cpp: In function 'int main(int, char**)':
                              ..\qt_test\main.cpp:4:14: warning: unused parameter 'argc' [-Wunused-parameter]
                               int main(int argc, char *argv[])
                                            ^~~~
                              ..\qt_test\main.cpp:4:31: warning: unused parameter 'argv' [-Wunused-parameter]
                               int main(int argc, char *argv[])
                                                             ^
                              g++ -Wl,-subsystem,console -mthreads -o debug\qt_test.exe debug/main.o  -LF:\Musor\libav\build\usr\local\lib F:\Musor\libav\build\usr\local\lib\libavformat.dll.a C:\Qt\Qt5.14.2\5.14.2\mingw73_64\lib\libQt5SerialPort.a C:\Qt\Qt5.14.2\5.14.2\mingw73_64\lib\libQt5Core.a   
                              debug/main.o: In function `main':
                              D:\projects_test\qt\qt_test\build-qt_test-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../qt_test/main.cpp:6: undefined reference to `avformat_license()'
                              collect2.exe: error: ld returned 1 exit status
                              mingw32-make[1]: *** [Makefile.Debug:68: debug/qt_test.exe] Error 1
                              mingw32-make: *** [Makefile:45: debug] Error 2
                              mingw32-make[1]: Leaving directory 'D:/projects_test/qt/qt_test/build-qt_test-Desktop_Qt_5_14_2_MinGW_64_bit-Debug'
                              18:45:50: The process "C:\Qt\Qt5.14.2\Tools\mingw730_64\bin\mingw32-make.exe" exited with code 2.
                              Error while building/deploying project qt_test (kit: Desktop Qt 5.14.2 MinGW 64-bit)
                              When executing step "Make"
                              

                              Whyyyyyyy?????
                              I have tried to change -llibavformat.dll to -lavformat, "-lavformat.dll" and "-lavformat" but i'm stil getting this error.

                              Pablo J. RoginaP 1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #21

                                Might be silly but try linking to all the ffmpeg libraries, just in case.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                B 1 Reply Last reply
                                0
                                • B BrMisha

                                  Men, I really don't understand what is happening.
                                  I installed msys2, and some packages for that, then i copied *c:\Qt\Qt5.14.2\Tools\mingw730_64* to *c:\msys64\mingw64*.
                                  Then built libav (it is "small" version of FFmpeg) and got this files:

                                  build\usr\local\bin\avcodec.lib
                                  build\usr\local\bin\avcodec-58.dll
                                  build\usr\local\bin\avconv.exe
                                  build\usr\local\bin\avdevice.lib
                                  build\usr\local\bin\avdevice-57.dll
                                  build\usr\local\bin\avfilter.lib
                                  build\usr\local\bin\avfilter-7.dll
                                  build\usr\local\bin\avformat.lib
                                  build\usr\local\bin\avformat-58.dll
                                  build\usr\local\bin\avprobe.exe
                                  build\usr\local\bin\avresample.lib
                                  build\usr\local\bin\avresample-4.dll
                                  build\usr\local\bin\avutil.lib
                                  build\usr\local\bin\avutil-56.dll
                                  build\usr\local\bin\swscale.lib
                                  build\usr\local\bin\swscale-5.dll
                                  
                                  build\usr\local\include\libavcodec\	<< here is *.h
                                  build\usr\local\include\libavdevice\	<< here is *.h
                                  build\usr\local\include\libavfilter\	<< here is *.h
                                  build\usr\local\include\libavformat\	<< here is *.h
                                  build\usr\local\include\libavresample\	<< here is *.h
                                  build\usr\local\include\libavutil\	<< here is *.h
                                  build\usr\local\include\libswscale\	<< here is *.h
                                  
                                  build\usr\local\lib\pkgconfig\
                                  build\usr\local\lib\avcodec-58.def
                                  build\usr\local\lib\avdevice-57.def
                                  build\usr\local\lib\avfilter-7.def
                                  build\usr\local\lib\avformat-58.def
                                  build\usr\local\lib\avresample-4.def
                                  build\usr\local\lib\avutil-56.def
                                  build\usr\local\lib\libavcodec.dll.a
                                  build\usr\local\lib\libavdevice.dll.a
                                  build\usr\local\lib\libavfilter.dll.a
                                  build\usr\local\lib\libavformat.dll.a
                                  build\usr\local\lib\libavresample.dll.a
                                  build\usr\local\lib\libavutil.dll.a
                                  build\usr\local\lib\libswscale.dll.a
                                  build\usr\local\lib\swscale-5.def
                                  

                                  *c:\Qt\Qt5.14.2\Tools\mingw730_64* was added to PATH. When I start, for example, avconv.exe, it works ok, so definitely libav was built with true mingw (which uses qt).
                                  Next, i added to *.pro (using "Add library...") this:

                                  win32: LIBS += -LF:/Musor/libav/build/usr/local/lib/ -llibavformat.dll
                                  INCLUDEPATH += F:/Musor/libav/build/usr/local/include
                                  DEPENDPATH += F:/Musor/libav/build/usr/local/include
                                  

                                  main.c:

                                  #include <libavformat/avformat.h>
                                  int main(int argc, char *argv[]) {
                                  	avformat_license();
                                  	return 0;
                                  }
                                  

                                  After compilation i got:

                                  C:/Qt/Qt5.14.2/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug
                                  mingw32-make[1]: Entering directory 'D:/projects_test/qt/qt_test/build-qt_test-Desktop_Qt_5_14_2_MinGW_64_bit-Debug'
                                  g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_SERIALPORT_LIB -DQT_CORE_LIB -I..\qt_test -I. -IF:\Musor\libav\build\usr\local\include -IC:\Qt\Qt5.14.2\5.14.2\mingw73_64\include -IC:\Qt\Qt5.14.2\5.14.2\mingw73_64\include\QtSerialPort -IC:\Qt\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Idebug -IC:\Qt\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++  -o debug\main.o ..\qt_test\main.cpp
                                  ..\qt_test\main.cpp: In function 'int main(int, char**)':
                                  ..\qt_test\main.cpp:4:14: warning: unused parameter 'argc' [-Wunused-parameter]
                                   int main(int argc, char *argv[])
                                                ^~~~
                                  ..\qt_test\main.cpp:4:31: warning: unused parameter 'argv' [-Wunused-parameter]
                                   int main(int argc, char *argv[])
                                                                 ^
                                  g++ -Wl,-subsystem,console -mthreads -o debug\qt_test.exe debug/main.o  -LF:\Musor\libav\build\usr\local\lib F:\Musor\libav\build\usr\local\lib\libavformat.dll.a C:\Qt\Qt5.14.2\5.14.2\mingw73_64\lib\libQt5SerialPort.a C:\Qt\Qt5.14.2\5.14.2\mingw73_64\lib\libQt5Core.a   
                                  debug/main.o: In function `main':
                                  D:\projects_test\qt\qt_test\build-qt_test-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/../qt_test/main.cpp:6: undefined reference to `avformat_license()'
                                  collect2.exe: error: ld returned 1 exit status
                                  mingw32-make[1]: *** [Makefile.Debug:68: debug/qt_test.exe] Error 1
                                  mingw32-make: *** [Makefile:45: debug] Error 2
                                  mingw32-make[1]: Leaving directory 'D:/projects_test/qt/qt_test/build-qt_test-Desktop_Qt_5_14_2_MinGW_64_bit-Debug'
                                  18:45:50: The process "C:\Qt\Qt5.14.2\Tools\mingw730_64\bin\mingw32-make.exe" exited with code 2.
                                  Error while building/deploying project qt_test (kit: Desktop Qt 5.14.2 MinGW 64-bit)
                                  When executing step "Make"
                                  

                                  Whyyyyyyy?????
                                  I have tried to change -llibavformat.dll to -lavformat, "-lavformat.dll" and "-lavformat" but i'm stil getting this error.

                                  Pablo J. RoginaP Offline
                                  Pablo J. RoginaP Offline
                                  Pablo J. Rogina
                                  wrote on last edited by
                                  #22

                                  @BrMisha said in Showing stream video:

                                  build\usr\local\bin\avformat.lib
                                  build\usr\local\bin\avformat-58.dll

                                  not sure if that's the issue, but you're showing libraries built in build\usr\local\bin but you're using build\usr\local\lib in your .pro file:

                                  win32: LIBS += -LF:/Musor/libav/build/usr/local/lib/ -llibavformat.dll

                                  In addition, and not sure since it's a long time I don't use libraries in Windows, also keep in mind that you have different names between the .lib and .dll files (avformat.lib vs. avformat-58.dll)

                                  Upvote the answer(s) that helped you solve the issue
                                  Use "Topic Tools" button to mark your post as Solved
                                  Add screenshots via postimage.org
                                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                  B 1 Reply Last reply
                                  0
                                  • SGaistS SGaist

                                    Might be silly but try linking to all the ffmpeg libraries, just in case.

                                    B Offline
                                    B Offline
                                    BrMisha
                                    wrote on last edited by BrMisha
                                    #23

                                    @SGaist said in Showing stream video:

                                    Might be silly but try linking to all the ffmpeg libraries, just in case.

                                    I tried to add this LIBS += -llibavcodec.dll -llibavdevice.dll -llibavfilter.dll -llibavformat.dll -llibavresample.dll -llibavutil.dll -llibswscale.dll but i'm still getting errors.
                                    By the way, if in cpp i'm adding

                                    extern "C" {
                                    	#include <libavformat/avformat.h>
                                    }
                                    

                                    then compils but falls in runtime on calling avformat_license()

                                    1 Reply Last reply
                                    0
                                    • Pablo J. RoginaP Pablo J. Rogina

                                      @BrMisha said in Showing stream video:

                                      build\usr\local\bin\avformat.lib
                                      build\usr\local\bin\avformat-58.dll

                                      not sure if that's the issue, but you're showing libraries built in build\usr\local\bin but you're using build\usr\local\lib in your .pro file:

                                      win32: LIBS += -LF:/Musor/libav/build/usr/local/lib/ -llibavformat.dll

                                      In addition, and not sure since it's a long time I don't use libraries in Windows, also keep in mind that you have different names between the .lib and .dll files (avformat.lib vs. avformat-58.dll)

                                      B Offline
                                      B Offline
                                      BrMisha
                                      wrote on last edited by
                                      #24

                                      @Pablo-J-Rogina "bin" contains *.exe and *dll. Libraries locates in "lib" folder

                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #25

                                        Because you are likely missing the path to the folder where the dlls are in the PATH environment variable.

                                        You can do that in the Run part of the Project panel.

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0
                                        • B Offline
                                          B Offline
                                          BrMisha
                                          wrote on last edited by
                                          #26

                                          But i did set *\libav\build\usr\local\bin\ to PATH before)))

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved