I'm new to opencv and ffmpeg so I don't know if this is a noob question. I'm writing a video with the following statement:
out = cv2.VideoWriter('videoname.mp4', cv2.VideoWriter_fourcc(*'X264'), 10, (frame_width, frame_height))
My program runs however, the video does not save. I tried looking for solutions online but none of them seem to work. What I have already tried:
*'XVID'
or *'MJPG'
but the file size is larger than what I require.0x00000021
as the fourcc argumentconda install -c conda-forge ffmpeg
(even though I already have built ffmpeg from source, I tried this)sudo apt-get install ffmpeg x264 libx264-dev
. I get the following result:Reading package lists... Done
Building dependency tree
Reading state information... Done
libx264-dev is already the newest version (2:0.152.2854+gite9a5903-2).
x264 is already the newest version (2:0.152.2854+gite9a5903-2).
ffmpeg is already the newest version (7:3.4.8-0ubuntu0.2).
0 upgraded, 0 newly installed, 0 to remove and 82 not upgraded.
Can someone help me where I could possibly be going wrong? I require the video codec to be x264 when saving the video to get a small file size.
Other info:
OpenCV version used: 4.2.0
Platform: Ubuntu 18.04
User contributions licensed under CC BY-SA 3.0