Open Source Computer Vision Library https://opencv.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
3.7 KiB

Video Decoding
==============
.. highlight:: cpp
11 years ago
cudacodec::VideoReader
----------------------
Video reader interface.
11 years ago
.. ocv:class:: cudacodec::VideoReader
.. note::
Merge remote-tracking branch 'origin/2.4' Conflicts: 3rdparty/ffmpeg/ffmpeg_version.cmake cmake/OpenCVFindLibsGrfmt.cmake cmake/templates/cvconfig.h.cmake modules/bioinspired/doc/retina/index.rst modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst modules/calib3d/src/precomp.hpp modules/contrib/src/inputoutput.cpp modules/contrib/src/precomp.hpp modules/core/include/opencv2/core/internal.hpp modules/core/include/opencv2/core/types_c.h modules/core/src/drawing.cpp modules/core/src/precomp.hpp modules/core/src/system.cpp modules/features2d/doc/common_interfaces_of_descriptor_matchers.rst modules/features2d/doc/common_interfaces_of_feature_detectors.rst modules/features2d/include/opencv2/features2d/features2d.hpp modules/features2d/src/precomp.hpp modules/flann/src/precomp.hpp modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst modules/gpu/doc/image_filtering.rst modules/gpu/doc/image_processing.rst modules/gpu/doc/video.rst modules/gpu/perf/perf_imgproc.cpp modules/gpu/perf4au/main.cpp modules/gpu/src/imgproc.cpp modules/gpu/src/precomp.hpp modules/gpu/test/test_imgproc.cpp modules/highgui/CMakeLists.txt modules/highgui/test/test_precomp.hpp modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst modules/imgproc/src/precomp.hpp modules/java/generator/src/cpp/Mat.cpp modules/legacy/src/precomp.hpp modules/ml/doc/k_nearest_neighbors.rst modules/ml/src/precomp.hpp modules/nonfree/doc/feature_detection.rst modules/nonfree/src/precomp.hpp modules/objdetect/include/opencv2/objdetect/objdetect.hpp modules/objdetect/src/cascadedetect.cpp modules/objdetect/src/hog.cpp modules/objdetect/src/precomp.hpp modules/objdetect/test/test_latentsvmdetector.cpp modules/ocl/src/hog.cpp modules/ocl/src/opencl/objdetect_hog.cl modules/ocl/src/precomp.hpp modules/photo/src/precomp.hpp modules/stitching/src/precomp.hpp modules/superres/perf/perf_precomp.hpp modules/superres/src/optical_flow.cpp modules/superres/src/precomp.hpp modules/superres/test/test_precomp.hpp modules/ts/include/opencv2/ts.hpp modules/video/src/precomp.hpp modules/videostab/src/precomp.hpp modules/world/src/precomp.hpp
12 years ago
* An example on how to use the videoReader class can be found at opencv_source_code/samples/gpu/video_reader.cpp
11 years ago
cudacodec::VideoReader::nextFrame
---------------------------------
Grabs, decodes and returns the next video frame.
11 years ago
.. ocv:function:: bool cudacodec::VideoReader::nextFrame(OutputArray frame)
If no frames has been grabbed (there are no more frames in video file), the methods return ``false`` . The method throws :ocv:class:`Exception` if error occurs.
11 years ago
cudacodec::VideoReader::format
------------------------------
Returns information about video file format.
11 years ago
.. ocv:function:: FormatInfo cudacodec::VideoReader::format() const
11 years ago
cudacodec::Codec
----------------
Video codecs supported by :ocv:class:`cudacodec::VideoReader` .
11 years ago
.. ocv:enum:: cudacodec::Codec
.. ocv:emember:: MPEG1 = 0
.. ocv:emember:: MPEG2
.. ocv:emember:: MPEG4
.. ocv:emember:: VC1
.. ocv:emember:: H264
.. ocv:emember:: JPEG
.. ocv:emember:: H264_SVC
.. ocv:emember:: H264_MVC
.. ocv:emember:: Uncompressed_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V'))
Y,U,V (4:2:0)
.. ocv:emember:: Uncompressed_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2'))
Y,V,U (4:2:0)
.. ocv:emember:: Uncompressed_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2'))
Y,UV (4:2:0)
.. ocv:emember:: Uncompressed_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V'))
YUYV/YUY2 (4:2:2)
.. ocv:emember:: Uncompressed_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y'))
UYVY (4:2:2)
11 years ago
cudacodec::ChromaFormat
-----------------------
Chroma formats supported by :ocv:class:`cudacodec::VideoReader` .
11 years ago
.. ocv:enum:: cudacodec::ChromaFormat
.. ocv:emember:: Monochrome = 0
.. ocv:emember:: YUV420
.. ocv:emember:: YUV422
.. ocv:emember:: YUV444
11 years ago
cudacodec::FormatInfo
---------------------
.. ocv:struct:: cudacodec::FormatInfo
Struct providing information about video file format. ::
struct FormatInfo
{
Codec codec;
ChromaFormat chromaFormat;
int width;
int height;
};
11 years ago
cudacodec::createVideoReader
----------------------------
Creates video reader.
11 years ago
.. ocv:function:: Ptr<VideoReader> cudacodec::createVideoReader(const String& filename)
.. ocv:function:: Ptr<VideoReader> cudacodec::createVideoReader(const Ptr<RawVideoSource>& source)
:param filename: Name of the input video file.
:param source: RAW video source implemented by user.
11 years ago
FFMPEG is used to read videos. User can implement own demultiplexing with :ocv:class:`cudacodec::RawVideoSource` .
11 years ago
cudacodec::RawVideoSource
-------------------------
.. ocv:class:: cudacodec::RawVideoSource
Interface for video demultiplexing. ::
class RawVideoSource
{
public:
virtual ~RawVideoSource() {}
virtual bool getNextPacket(unsigned char** data, int* size, bool* endOfFile) = 0;
virtual FormatInfo format() const = 0;
};
User can implement own demultiplexing by implementing this interface.
11 years ago
cudacodec::RawVideoSource::getNextPacket
----------------------------------------
Returns next packet with RAW video frame.
11 years ago
.. ocv:function:: bool cudacodec::VideoSource::getNextPacket(unsigned char** data, int* size, bool* endOfFile) = 0
:param data: Pointer to frame data.
:param size: Size in bytes of current frame.
:param endOfStream: Indicates that it is end of stream.
11 years ago
cudacodec::RawVideoSource::format
---------------------------------
Returns information about video file format.
11 years ago
.. ocv:function:: virtual FormatInfo cudacodec::RawVideoSource::format() const = 0