# Except MJPG any codec doesn't work

**URL:** <https://forum.opencv.org/t/except-mjpg-any-codec-doesnt-work/11539>\
**Category:** C++\
**Tags:** videoio\
**Created:** [January 9, 2023, 1:04am UTC](https://forum.opencv.org/t/except-mjpg-any-codec-doesnt-work/11539 "2023-01-09T01:04:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbird](https://avatars.discourse-cdn.com/v4/letter/n/5f8ce5/32.png) [@newbird](https://forum.opencv.org/u/newbird)\
**Post date:** [January 9, 2023, 1:04am UTC](https://forum.opencv.org/t/except-mjpg-any-codec-doesnt-work/11539/1 "2023-01-09T01:04:01Z")

</div>

using videowriter, tried to save MATs into video file(like ‘.avi’ 'mp4 etc)

only I could make .avi with MJPG codec.

should I install additional things to use other codec like h264?

i’m using ubuntu os, QT environment

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [January 9, 2023, 8:25am UTC](https://forum.opencv.org/t/except-mjpg-any-codec-doesnt-work/11539/2 "2023-01-09T08:25:04Z")

</div>

opencv version ? self built ?  
output of `cout << getBuildInformation();` ? (there’s a VideoIO section)

> [@newbird](#):
>
> only I could make .avi with MJPG codec.

this is indeed the only ‘builtin’ codec,  
anything else is handled from ffmpeg / gstreamer

---

<div class="post-metadata">

**Author:** ![newbird](https://avatars.discourse-cdn.com/v4/letter/n/5f8ce5/32.png) [@newbird](https://forum.opencv.org/u/newbird)\
**Post date:** [January 10, 2023, 6:32am UTC](https://forum.opencv.org/t/except-mjpg-any-codec-doesnt-work/11539/3 "2023-01-10T06:32:35Z")

</div>

…then I must build it again…?

```auto
General configuration for OpenCV 4.6.0-dev =====================================
  Version control: unknown

  Platform:
    Timestamp: 2022-12-19T03:12:02Z
    Host: Linux 5.4.0-135-generic x86_64
    CMake: 3.10.2
    CMake generator: Unix Makefiles
    CMake build tool: /usr/bin/make
    Configuration: Release

  CPU/HW features:
    Baseline: SSE SSE2 SSE3
      requested: SSE3
    Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (18 files): + SSSE3 SSE4_1
      SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (34 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?: YES
    C++ standard: 11
    C++ Compiler: /usr/bin/c++ (ver 7.5.0)
    C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
    C++ flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
    C Compiler: /usr/bin/cc
    C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
    C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
    Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
    Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
    ccache: NO
    Precompiled headers: NO
    Extra dependencies: dl m pthread rt
    3rdparty dependencies:

  OpenCV modules:
    To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching ts video videoio
    Disabled: world
    Disabled by dependency: -
    Unavailable: java python2 python3
    Applications: tests perf_tests apps
    Documentation: NO
    Non-free algorithms: NO

  GUI: GTK3
    GTK+: YES (ver 3.22.30)
      GThread : YES (ver 2.56.4)
      GtkGlExt: NO
    VTK support: NO

  Media I/O:
    ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
    JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
    WEBP: build (ver encoder: 0x020f)
    PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
    TIFF: build (ver 42 - 4.2.0)
    JPEG 2000: build (ver 2.4.0)
    OpenEXR: build (ver 2.3.0)
    HDR: YES
    SUNRASTER: YES
    PXM: YES
    PFM: YES

  Video I/O:
    DC1394: NO
    FFMPEG: NO
      avcodec: NO
      avformat: NO
      avutil: NO
      swscale: NO
      avresample: NO
    GStreamer: NO
    v4l/v4l2: YES (linux/videodev2.h)

  Parallel framework: pthreads

  Trace: YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP: 2020.0.0 Gold [2020.0.0]
           at: /home/mskim/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
    Intel IPP IW: sources (2020.0.0)
              at: /home/mskim/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
    VA: NO
    Lapack: NO
    Eigen: NO
    Custom HAL: NO
    Protobuf: build (3.19.1)

  OpenCL: YES (no extra features)
    Include path: /home/mskim/opencv/opencv/3rdparty/include/opencl/1.2
    Link libraries: Dynamic load

  Python (for build): /usr/bin/python2.7

  Java:
    ant: NO
    JNI: NO
    Java wrappers: NO
    Java tests: NO

  Install to: /usr/local
-----------------------------------------------------------------

```

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [January 10, 2023, 6:40am UTC](https://forum.opencv.org/t/except-mjpg-any-codec-doesnt-work/11539/4 "2023-01-10T06:40:04Z")

</div>

> [@newbird](#):
>
> …then I must build it again…?

i think so, too . . . . ;/
