opening ffmpeg/mpeg-4 avi in openCV 3 python 2.7 -


i stuck trying open mpeg4 video file in opencv. video file generated in ffmpeg using command:

ffmpeg -y -f rawvideo -vcodec rawvideo -s 2048x2048 -r 30 -pix_fmt gray -i \\.\pipe\pipe1 -qv 5 -vcodec mpeg4 out.avi 

now trying open file this

import cv2 #avi_path full path avi cap = cv2.videocapture(avi_path) img1=cap.read() 

but returns: false, none

the same procedure works fine if use libxvid encoding instead want use mpeg4 because encodes faster (i need encode several streams simultaneously).

should opencv able open mpeg4 encoded avi file?

i using opencv3 , python 2.7 under windows 64bit

i attaching gspot panels of 1 video encoded in xvid (left) can open. , 1 video encoded in mpeg4 (right) cannot open. enter image description here have suspicion lav splitter/decoder settings may interfere ?! - don't understand enough of bottom of it.

this ffprobe output mpeg4 file encoded additional ffmpeg parameter '-vtag xvid' suggested in comment mulvya

  ffprobe version n-75474-g74e4948 copyright (c) 2007-2015 ffmpeg developers   built gcc 4.9.3 (gcc)   configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib   libavutil      55.  2.100 / 55.  2.100   libavcodec     57.  3.100 / 57.  3.100   libavformat    57.  2.100 / 57.  2.100   libavdevice    57.  0.100 / 57.  0.100   libavfilter     6.  6.100 /  6.  6.100   libswscale      4.  0.100 /  4.  0.100   libswresample   2.  0.100 /  2.  0.100   libpostproc    54.  0.100 / 54.  0.100 input #0, avi, 'out1b.avi':   metadata:     encoder         : lavf57.2.100   duration: 00:00:23.50, start: 0.000000, bitrate: 2049 kb/s     stream #0:0: video: mpeg4 (simple profile) (xvid / 0x64697678), yuv420p, 2048x2048 [sar 1:1 dar 1:1], 2044 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc 

try adding -vtag xvid output option ffmpeg command

the codec tag tells player/processor decoder use input video stream. although xvid , mpeg4 encoders of same codec, maybe opencv doesn't recognize videos tagged mpeg4.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -