Open Bear35805 opened 9 years ago
Hello
Will QtMEL help with this?
Yes, it will. Here is what you need: 1) Subclass the AbstractImageGrabber class and override captureFrame method. You can look into screengrabber.cpp for example. 2) Use Recorder class to encode video/audio. Look into examples folder.
Also I am use Qt5.4 with MSVC2013. Do I need to build your library or are the dlls already available and I missed them?
Unfortunately, you have to build it yourself, because I haven't worked on QtMEL since 2013.
If you have any questions, please feel free to ask.
Thank you for the reply.
I have been trying to build it and I get the following: 15:34:12: Running steps for project qtmel... 15:34:12: Configuration unchanged, skipping qmake step. 15:34:12: Starting: "C:\Qt\Qt5.4.1\Tools\QtCreator\bin\jom.exe" C:\Qt\Qt5.4.1\Tools\QtCreator\bin\jom.exe -f Makefile.Debug all cl -c -nologo -Zm200 -Zc:wchar_t -FS -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fd..\kibsoft-QtMEL-e170fa8\libsQt5\qtmeld1.pdb -DUNICODE -DWIN32 -DQTMEL_LIBRARY -DWINDOWS_DS__ -DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I"..\kibsoft-QtMEL-e170fa8" -I"." -I"..\kibsoft-QtMEL-e170fa8\src\3rdparty\RtAudio\include" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtWidgets" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtMultimedia" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtGui" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtNetwork" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtCore" -I"build\moc" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\mkspecs\win32-msvc2013" -Fobuild\obj\ @C:\Users\kbrooks\AppData\Local\Temp\cameragrabber.obj.3912.31.jom cameragrabber.cpp cl -c -nologo -Zm200 -Zc:wchar_t -FS -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fd..\kibsoft-QtMEL-e170fa8\libsQt5\qtmeld1.pdb -DUNICODE -DWIN32 -DQTMEL_LIBRARY -DWINDOWS_DS__ -DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I"..\kibsoft-QtMEL-e170fa8" -I"." -I"..\kibsoft-QtMEL-e170fa8\src\3rdparty\RtAudio\include" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtWidgets" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtMultimedia" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtGui" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtNetwork" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\include\QtCore" -I"build\moc" -I"C:\Qt\Qt5.4.1\5.4\msvc2013_opengl\mkspecs\win32-msvc2013" -Fobuild\obj\ @C:\Users\kbrooks\AppData\Local\Temp\encoder.obj.3912.47.jom encoder.cpp ..\kibsoft-QtMEL-e170fa8\src\encoder\encoder.cpp(32) : fatal error C1083: Cannot open include file: 'libavcodec/avcodec.h': No such file or directory C:/OpenCVLibs/install/include/opencv/cv.h(63) : fatal error C1083: Cannot open include file: 'opencv2/core/core_c.h': No such file or directory jom: C:\Users\kbrooks\Downloads\kibsoft-QtMEL-1.0-alpha2-12-ge170fa8\build-qtmel-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug\Makefile.Debug [build\obj\cameragrabber.obj] Error 2 jom: C:\Users\kbrooks\Downloads\kibsoft-QtMEL-1.0-alpha2-12-ge170fa8\build-qtmel-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug\Makefile.Debug [build\obj\encoder.obj] Error 2 jom: C:\Users\kbrooks\Downloads\kibsoft-QtMEL-1.0-alpha2-12-ge170fa8\build-qtmel-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug\Makefile [debug-all] Error 2 15:34:14: The process "C:\Qt\Qt5.4.1\Tools\QtCreator\bin\jom.exe" exited with code 2. Error while building/deploying project qtmel (kit: Desktop Qt 5.4.1 MSVC2013 OpenGL 32bit) When executing step "Make" 15:34:14: Elapsed time: 00:02.
I believe in the pro file $$(FFMPEG_INCLUDE_PATH) is trying to pull and system environment variable. I set the variable to the appropriate path but still get the error.
Did you set this variable in Qt Creator? Or in the system? Also you can try to replace $$(FFMPEG_INCLUDE_PATH) with your path in the .pro file.
I was setting it in the System, but I just set it in Qt Creator and ran Qmake and it fixed it thanks.
Now I am running into a link error. It is saying can not open file avcodec-53.lib. There is a dll by that name in the FEMPEG_LIBRARY_PATH directory.
Notice, it requires .lib file(I guess because you use MSVC). So, it should be in FEMPEG_LIBRARY_PATH as well as .dll.
Is there a location I can obtain the libs, or do I need to compile them as well?
I think you can get it here: http://ffmpeg.zeranoe.com/builds/ Look at the DEV package. You can download DEV and SHARED packages, it should work. The first contains .lib files and the second - .dlls.
But seems you have to build it with your version of MSVC.
I have worked through most of the issues building it, but ran into these.
08:51:00: Starting: "C:\Qt\Qt5.4.1\Tools\QtCreator\bin\jom.exe"
C:\Qt\Qt5.4.1\Tools\QtCreator\bin\jom.exe -f Makefile.Debug all
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /DLL /SUBSYSTEM:WINDOWS /VERSION:1.00 /MANIFEST:embed /OUT:..\kibsoft-QtMEL-e170fa8\libsQt5\qtmeld1.dll @C:\Users\kbrooks\AppData\Local\Temp\qtmeld1.dll.9712.15.jom
Creating library ..\kibsoft-QtMEL-e170fa8\libsQt5\qtmeld1.lib and object ..\kibsoft-QtMEL-e170fa8\libsQt5\qtmeld1.exp
encoder.obj : error LNK2019: unresolved external symbol _av_new_stream referenced in function "private: bool __thiscall EncoderPrivate::createVideoStream(void)" (?createVideoStream@EncoderPrivate@@AAE_NXZ)
cameragrabber.obj : error LNK2019: unresolved external symbol _cvCreateCameraCapture referenced in function "public: static class QSize __cdecl CameraGrabber::maximumFrameSize(int)" (?maximumFrameSize@CameraGrabber@@SA?AVQSize@@H@Z)
cameragrabber.obj : error LNK2019: unresolved external symbol _cvQueryFrame referenced in function "private: virtual class QImage __thiscall CameraGrabber::captureFrame(void)" (?captureFrame@CameraGrabber@@EAE?AVQImage@@XZ)
cameragrabber.obj : error LNK2019: unresolved external symbol _cvReleaseCapture referenced in function "public: static class QSize __cdecl CameraGrabber::maximumFrameSize(int)" (?maximumFrameSize@CameraGrabber@@SA?AVQSize@@H@Z)
cameragrabber.obj : error LNK2019: unresolved external symbol _cvGetCaptureProperty referenced in function "public: static class QSize __cdecl CameraGrabber::maximumFrameSize(int)" (?maximumFrameSize@CameraGrabber@@SA?AVQSize@@H@Z)
..\kibsoft-QtMEL-e170fa8\libsQt5\qtmeld1.dll : fatal error LNK1120: 5 unresolved externals
jom: C:\Users\kbrooks\Downloads\kibsoft-QtMEL-1.0-alpha2-12-ge170fa8\build-qtmel-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug\Makefile.Debug [..\kibsoft-QtMEL-e170fa8\libsQt5\qtmeld1.dll] Error 1120
jom: C:\Users\kbrooks\Downloads\kibsoft-QtMEL-1.0-alpha2-12-ge170fa8\build-qtmel-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug\Makefile [debug-all] Error 2
08:51:01: The process "C:\Qt\Qt5.4.1\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project qtmel (kit: Desktop Qt 5.4.1 MSVC2013 OpenGL 32bit)
When executing step "Make"
08:51:01: Elapsed time: 00:00.
I have attached my pro file as well.
Sincerely, Kevin J. Brooks
TEMPLATE = lib
VERSION = 1.0.0 QMAKE_TARGET_COMPANY = "Kirill Bukaev(aka KIBSOFT)" QMAKE_TARGET_COPYRIGHT = "Copyright © 2013 Kirill Bukaev(aka KIBSOFT)" QMAKE_TARGET_PRODUCT = "QtMEL" QMAKE_TARGET_DESCRIPTION = "Qt Media Encoding Library"
OBJECTS_DIR = build/obj MOC_DIR = build/moc RESOURCES = resources.qrc
greaterThan(QT_MAJOR_VERSION, 4) { QT += widgets multimedia DESTDIR = $$PWD/libsQt5 } else {
CONFIG += mobility
MOBILITY += multimedia
DESTDIR = $$PWD/libsQt4
}
DEFINES += QTMEL_LIBRARY CONFIG += debug_and_release build_all no_keywords
CONFIG(debug, debug|release) { TARGET = qtmeld } else { TARGET = qtmel }
INCLUDEPATH += $$(FFMPEG_INCLUDE_PATH) $$(OPENCV_INCLUDE_PATH) ./src/3rdparty/RtAudio/include LIBS += -L$$(FFMPEG_LIBRARY_PATH) -L$$(OPENCV_LIBRARY_PATH)
win32 { DEFINES += WINDOWS_DS LIBS += -ldsound -lole32 -lwinmm SOURCES += src/helpers/mousehelper_win.cpp
LIBS += -lavcodec \
-lavformat \
-lswscale \
-lavutil \
-ldsound \
-lole32 \
-lwinmm
win32-g++ {
LIBS += -lopencv_highgui300
LIBS += -lopencv_core300
} else {
LIBS += -lopencv_highgui300
}
}
unix { DEFINES += LINUX_ALSA SOURCES += src/helpers/mousehelper_x11.cpp
LIBS += -lavcodec \
-lavformat \
-lswscale \
-lavutil \
-lopencv_highgui \
-lasound
#make install
headers1.files = ./src/grabbers/image/*.h
headers1.path = /usr/local/include/src/grabbers/image
headers2.files = ./src/grabbers/audio/*.h
headers2.path = /usr/local/include/src/grabbers/audio
headers3.files = ./src/grabbers/*.h
headers3.path = /usr/local/include/src/grabbers
headers4.files = ./src/encoder/*.h
headers4.path = /usr/local/include/src/encoder
headers5.files = ./src/helpers/*.h
headers5.path = /usr/local/include/src/helpers
headers6.files = ./src/*.h
headers6.path = /usr/local/include/src
headers7.files = ./include/*
headers7.path = /usr/local/include
greaterThan(QT_MAJOR_VERSION, 4) {
libs.files = ./libsQt5/*
} else {
libs.files = ./libsQt4/*
}
libs.path = /usr/local/lib
INSTALLS += headers1 headers2 headers3 headers4 headers5 headers6 headers7 libs
}
SOURCES += src/grabbers/abstractgrabber.cpp \ src/grabbers/image/abstractimagegrabber.cpp \ src/grabbers/image/screengrabber.cpp \ src/helpers/mousehelper.cpp \ src/encoder/encoder.cpp \ src/encoder/videocodecsettings.cpp \ src/grabbers/audio/audiograbber.cpp \ src/encoder/audiocodecsettings.cpp \ src/grabbers/image/cameragrabber.cpp \ src/3rdparty/RtAudio/RtAudio.cpp \ src/helpers/recorder.cpp \ src/helpers/audiotimer.cpp
HEADERS += src/grabbers/abstractgrabber.h\ src/qtmel_global.h \ src/grabbers/image/abstractimagegrabber.h \ src/grabbers/image/screengrabber.h \ src/helpers/mousehelper.h \ src/helpers/mousehelper_p.h \ src/encoder/encoder.h \ src/encoder/encoderglobal.h \ src/encoder/videocodecsettings.h \ src/grabbers/audio/audiograbber.h \ src/encoder/audiocodecsettings.h \ src/grabbers/image/cameragrabber.h \ src/3rdparty/RtAudio/RtError.h \ src/3rdparty/RtAudio/RtAudio.h \ src/helpers/recorder.h \ src/helpers/audiotimer.h
It seems you don't have .lib files for OpenCV
I do, and they are in the directory that OPENCV_LIBRARY_PATH specifies, which is why I am confused.
I am not a fan of MSVC, and would prefer to work with MingW, but my superiors prefer MSVC.
Sincerely, Kevin J. BrooksIt seems you don't have .lib files for OpenCV
— Reply to this email directly or view it on GitHub https://github.com/kibsoft/QtMEL/issues/30#issuecomment-107995518.
I have another question. I had my program working with OpenCV and using the feed from the video capture device. Then all of a sudden my program started locking up the system on the cvCreateCameraCapture(0) call. What is different about QtMel that that call will not freeze the system up?
You can look at the abstractimagegrabber.cpp. I call the grab() function using QtConcurrent.
Thank you for the quick reply
I am having one last link problem, but I can't seem to find the library. The unresolved symbol is unresolved external symbol _av_new_stream. It seems this should be in avformat, and I am linking that library.
Maybe you have to build it with MSVC yourself. I don't have another idea. I have built it only with MSVC2010, but I don't remember such troubles. https://dl.dropboxusercontent.com/u/77719957/QtMEL/QtMEL_Qt5_MSVC2010.zip
Did I read some place that the frame rate is variable?
There is the latency variable in AbstractImageGrabber/CameraGrabber
/! Sets the image capture latency. It may be used to reduce CPU usage(especially on single-core processors) and to lower frame rate. The default value is 0. It means that the grabber will try to capture as many frames as possible. \sa latency() / void setLatency(int latency);
Thanks for your reply, but I am forced to abandon QtMel. After you sent the libraries you built using VS2010, and I attempted to build the camera example, the program crashed immediately in debug. I promised my supervisor, if I was not able to work with QtMel by lunch time, I would explore other options.
Sincerely, Kevin J. Brooks
No problem.
It appears you are combining video and audio in the same file using RTAudio. Which file of yours does the video and audio get merged?
Sincerely, Kevin J. Brooks Senior Software Engineer R2C Support Services 200 West Side Square Suite 604 Huntsville, AL 35801 Office: 256-684-8383 ext. 104
On 6/3/2015 2:35 PM, Kirill Bukaev wrote:
No problem.
— Reply to this email directly or view it on GitHub https://github.com/kibsoft/QtMEL/issues/30#issuecomment-108590721.
It appears you are combining video and audio in the same file using RTAudio.
No. It is done with Ffmpeg/LibAv.
You can look into helpers/recorder.cpp. The Encoder does all the work. We just pass data from grabbers into it.
I did get your library to compile finally and I am trying to use it. Is there a way to discover what microphones are on the system?
Yes, look at AudioGrabber::availableDevices
Thanks, that helped.
Now I am getting a division by zero at this line. I am sure I am
causing it by not having something set right, but I am not sure what.
Any ideas?
if (avcodec_open2(m_videoCodecContext, m_videoCodec, NULL) < 0)
Ffmpeg crashes very often because of codec settings. Look at the examples, there you can find working codec settings. I mean VideoCodecSettings;
Mr. Bukaev,
Thanks for all your assistance. Obviously I need to learn more about Codecs. Do you have an online reference where I can read about them?
Bear
Ffmpeg crashes very often because of codec settings. Look at the examples, there you can find working coded settings. I mean VideoCodecSettings;
— Reply to this email directly or view it on GitHub https://github.com/kibsoft/QtMEL/issues/30#issuecomment-111281677.
Actually I'm not very strong in codecs, I have used presets I found on the Internet in my examples. You can google "ffmpeg codecs" or "libav codecs".
I am getting and Encoder Error 9 when I try to record with audio. I have my audio codec settings in my program set up exactly as the the example program. I am assuming that the Codec for MP3 is missing from the system, which is causing this error. Any idea where I can find it for Windows 7?
Sincerely, Kevin J. Brooks Senior Software Engineer R2C Support Services 200 West Side Square Suite 604 Huntsville, AL 35801 Office: 256-684-8383 ext. 104
On 6/12/2015 2:50 PM, Kirill Bukaev wrote:
Actually I'm not very strong in codecs, I have used presets I found on the Internet in my examples. You can google "ffmpeg codecs" or "libav codecs".
— Reply to this email directly or view it on GitHub https://github.com/kibsoft/QtMEL/issues/30#issuecomment-111598329.
It seems your FFmpeg build doesn't have it. I have only tested with the version of FFmpeg that I uploaded to my website(http://kibsoft.ru). Try to use another version of FFmpeg dlls.
That is the one I built with as well.
Sincerely, Kevin J. Brooks Senior Software Engineer R2C Support Services 200 West Side Square Suite 604 Huntsville, AL 35801 Office: 256-684-8383 ext. 104
On 6/15/2015 8:49 AM, Kirill Bukaev wrote:
It seems your FFmpeg build doesn't have it. I have only tested with the version of FFmpeg that I uploaded to my website(http://kibsoft.ru).
— Reply to this email directly or view it on GitHub https://github.com/kibsoft/QtMEL/issues/30#issuecomment-112077857.
I apologize for asking a question that is not a issue with QtMEL. I am building and application that needs to take video from a Video Capture device. The camera at the other end of the device is sending Composite video. As the frames come in I need to draw text and other objects on them, then display and record them into a file along with audio. Will QtMEL help with this?
Also I am use Qt5.4 with MSVC2013. Do I need to build your library or are the dlls already available and I missed them?