Questions tagged [fourcc]

FourCC (literally, four-character code) is a sequence of four bytes used to uniquely identify data formats. The concept originated in the OSType scheme used in the Macintosh system software and was adopted for the Amiga/Electronic Arts Interchange File Format and derivatives. The idea was later reused to identify compressed data types in QuickTime and DirectShow.

Overview

FOURCC is short for "four character code" - an identifier for a video codec, compression format, color or pixel format used in media files. A character in this context is a 1 byte/8 bit value, thus a FOURCC always takes up exatly 32 bits/4 bytes in a file. Another way to write FOURCC is 4CC (4 as in "four" character code). The four characters in a FOURCC is generally limited to be within the human readable characters in the ASCII table. Because of this it is easy to convey and communicate what the FOURCCs are within a media file. AVI files is the most widespread, or the first widely used media file format, to use FOURCC identifiers for the codecs used to compress the various video/audio streams within the files. Some of the more well known FOURCCs include "DIVX", "XVID", "H264", "DX50". But these are just a few of the hundreds in use.

46 questions
17
votes
16 answers

iOS/C: Convert "integer" into four character string

A lot of the constants associated with Audio Session programming are really four-character strings (Audio Session Services Reference). The same applies to the OSStatus code returned from functions like AudioSessionGetProperty. The problem is that…
Spencer Williams
  • 902
  • 8
  • 26
13
votes
1 answer

Specify Compression Quality in Python for OpenCV Video Object

I must create low resolution AVI videos using a large number of jpeg images contained in individual directories. I have nearly one hundred directories, and each directory may contain many thousands of images. In order to automate this process, I…
KRH
  • 133
  • 1
  • 1
  • 5
12
votes
4 answers

OpenCV: FFMPEG: tag is not supported with codec id 12 and format 'mp4 / MP4

I was trying to run a repo located HERE. Basically, just targeting SimpleVideoSummarizer.cc which uses OpenCV for some basic video processing. I'm using Ubuntu 14.04. Following is the save part of the code: void…
Tina J
  • 4,983
  • 13
  • 59
  • 125
11
votes
1 answer

Video codec for H264 with opencv

I am trying to create a movie using opencv and I need that output file be in H264 format. I used the following fourcc in opencv, but I am getting error that suitable codec is not installed. fourcc=CV_FOURCC('H','2','6','4') ; When I run my…
mans
  • 17,104
  • 45
  • 172
  • 321
10
votes
3 answers

Writing an MP4 file on the Mac with OpenCV ffmpeg

I am using OpenCV with ffmpeg on a mac to write video. I've been able to successfully write .avi files using the codec/fourcc code, FMP4. I would like to write .mp4 files, however. When I try to write an .mp4 file using fourcc FMP4 I get this…
Sameer Parekh
  • 131
  • 1
  • 1
  • 6
7
votes
4 answers

python - Output by OpenCV VideoWriter empty

I have recently started to program with opencv-python, but I got stuck when I tried to write a video using cv2. The output by the script is empty. Here's my code: import cv2 import numpy as np import matplotlib.pyplot as plt cap =…
MisterMM23
  • 220
  • 5
  • 14
6
votes
12 answers

Set a FourCC value in C++

I want to set a FourCC value in C++, i.e. an unsigned 4 byte integer. I suppose the obvious way is a #define, e.g. #define FOURCC(a,b,c,d) ( (uint32) (((d)<<24) | ((c)<<16) | ((b)<<8) | (a)) ) and then: uint32 id( FOURCC('b','l','a','h') ); What…
Nick
  • 27,566
  • 12
  • 60
  • 72
6
votes
3 answers

Lossless avi encoding on linux

I am trying to write video using opencv. It is important for me to do this precisely - so it has to be a lossless codec. I am working with OpenCV 2.4.1 on Ubuntu 12.04 Previously, I was using the fourcc code 0. This gave me the exact result I…
dlants
  • 761
  • 1
  • 8
  • 14
5
votes
1 answer

Resizing video using opencv and saving it

I'm trying to re-size the video using opencv and then save it back to my system.The code works and does not give any error but output video file is corrupted. The fourcc I am using is mp4v works well with .mp4 but still the output video is…
Mitul Tandon
  • 53
  • 1
  • 5
4
votes
0 answers

How to switch camera to YUY2 format in opencv

I'm trying to get my camera to capture video using the YUY2 format instead of the MJPEG format that it currently uses. How can I do this in OpenCV? So I've looked into the fourcc codes that are provided in OpenCV and I've tried…
nickpm21
  • 41
  • 1
  • 2
4
votes
0 answers

Undocumented CoreAudio control classes

While exploring the CoreAudio HAL object tree, I came across two mysterious boolean controls that are exposed on the built-in microphone and the built-in output on my MBP with macOS 10.13 but don't appear anywhere in the documentation or system…
Lvsti
  • 1,525
  • 15
  • 15
4
votes
1 answer

Using FourCharCode / SecItemAttr constants from Swift

I'm playing around with some Mac OS X Keychain / Security APIs using Swift. So far, I've been able to successfully fetch both a username and a password from an existing keychain item (by setting both kSecReturnAttributes and kSecReturnAttributes to…
bgentry
  • 316
  • 1
  • 2
  • 12
4
votes
1 answer

Lookup compressor/filter friendly name from FOURCC ID in Delphi 6 application?

I have a Delphi 6 application that asks the user to select an audio and video compressor using AVISaveOptions(). I then store the FOURCC IDs of each selection in a data file. I want to look up the Filter friendly name for each selection using the…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
3
votes
1 answer

Python CV2 video writer doesn't save video

I have a simple python code using OpenCV and Keras that performs some detections on frames (follow-up from my previous question here). But when I want to record and save the frames as a video using video_writer, the generated video is empty. What is…
Tina J
  • 4,983
  • 13
  • 59
  • 125
3
votes
0 answers

Why does the Lagarith Lossless Video Codec (LAGS) not work on Python?

I am trying to save 2 videos from my laptop camera with the same size and pixel values of the frames, using OpenCV with Python. I'm changing the RGB values of some pixels in frames in the second video. I want to save the videos without any…
Georgi Valchev
  • 103
  • 2
  • 11
1
2 3 4