Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFMPEG method to decode a MPEG video [closed]
2 juin 2017, par Sanduni WickramasingheCan any one tell me which is the method or class that can be used to decode a mpeg video. Here decode mean I need to get the video frames in pixel level. That means to read each frame as an 2D array of integers. I have gone through ffmpeg source code and there are several decode methods. I found avcodec_receive_frame()/avcodec_send_frame() methods which are inside Decode function
-
To detect face in a video file
2 juin 2017, par Yaswanth PushpakMy code is to detect face in a video .but video is not being loaded even I have given the right path . Also i installed ffmpeg but there are no .dll files in it.I am struck here anyone can help me?
import cv2 import numpy as np faceDetect=cv2.CascadeClassifier('C:\\OPENCV\\opencv\\sources\\data\\haarcascades\\haarcascade_frontalface_default.xml') ret,cam=cv2.VideoCapture('D:\\New folder (5)\\New folder (3)\\Ae Dil Hai Mushkil.mp4') img=cam.read() while(cam.isOpened()): ret,img=cam.read(); if not ret: break gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) faces=faceDetect.detectMultiScale(gray,1.3,5); `enter code here`for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2) cv2.imshow("Face",img); if(cv2.waitKey(1) & 0xFF==ord('q')): break; cam.release() cv2.destroyAllWindows()
Error: Traceback (most recent call last): File "D:\New folder (5)\New folder (3)\facedet.py", line 5, in ret,cam=cv2.VideoCapture('D:\New folder (5)\New folder (3)\Ae Dil Hai Mushkil.mp4') TypeError: 'cv2.VideoCapture' object is not iterable
-
Getting Intra-Frames from a video
2 juin 2017, par ThomasFirst, let me preface this with saying that I have to process a massive amount of videos and shaving even 1 second per video is very significant.
I'm trying to extract the position of all intra-frames in a video.
FFProbe works, but it's amazingly slow.
FFMpeg works much faster, but it's still quite slow.
So, my question is if there is a lib, where I could do something like this pseudo code:
var frame = first_frame; do { if (frame.type == intra_frame) log(frame.time); frame = frame.next; } while (frame != null);
and scan through the video very fast, not looking at anything inside the frames, but just the headers to find the type of the frame and move on to the next.
The end goal is to generate filmstrips, for preview, as fast as possible. I need to generate 48 thumbnails roughly evenly spread through the movie and covering the whole movie span (excluding 5 sec on each end). I am hoping to speed the process up by extracting only intra-frames. Since I need a fixed number of thumbnails, I can only do this by knowing the total amount of intra-frames.
This scenario works only if the time to find all the intra-frame indices and extract 48 intra frames is less than getting frames, in a single pass, at regular intervals, 48 times.
Edit: This is the solution I have found so far; in this example I take one frame every minuteffmpeg -hide_banner -skip_frame nokey -i _a.mp4 -vf "select='eq(pict_type\,PICT_TYPE_I)*(lt(abs(t\-30)\,2)+lt(abs(t\-90)\,2)+lt(abs(t\-150)\,2)+lt(abs(t\-180)\,2)+lt(abs(t\-240)\,2)+lt(abs(t\-300)\,2)+lt(abs(t\-360)\,2)+lt(abs(t\-420)\,2))',showinfo,scale=640:480,tile=6x8" -vsync 0 frames.jpg
I found that if I specify the frames directly, I don't really get a speed difference.
Short of going through the API, is there anything faster with FFMPEG?
-
install ffmpeg on debian gives "unmet dependencies"
1er juin 2017, par yarekI was trying to upgrade my FFMPEG. Now when I run:
apt-get install ffmpeg
The following packages have unmet dependencies: ffmpeg : Depends: libavcodec57 (>= 10:3.3.1) but it is not going to be installed Depends: libavdevice57 (>= 10:3.3.1) but it is not going to be installed Depends: libavfilter6 (>= 10:3.3.1) but it is not going to be installed Depends: libavformat57 (>= 10:3.3.1) but it is not going to be installed Depends: libavresample3 (>= 10:3.3.1) but it is not going to be installed Depends: libavutil55 (>= 10:3.3.1) but it is not going to be installed Depends: libc6 (>= 2.14) but 2.13-38+deb7u11 is to be installed Depends: libpostproc54 (>= 10:3.3.1) but it is not going to be installed Depends: libsdl2-2.0-0 (>= 2.0.4) but it is not going to be installed Depends: libswresample2 (>= 10:3.3.1) but it is not going to be installed Depends: libswscale4 (>= 10:3.3.1) but it is not going to be installed x264 : Depends: libavutil55 (>= 10:3.3.1) but it is not going to be installed Depends: libc6 (>= 2.14) but 2.13-38+deb7u11 is to be installed Depends: libffms2-4 (>= 1:2.23) but it is not going to be installed Depends: libswscale4 (>= 10:3.3.1) but it is not going to be installed Depends: libx264-150 but it is not going to be installed E: Unable to correct problems, you have held broken packages.
-
Forcing custom H.264 intra-frames (keyframes) at encode-time ?
1er juin 2017, par Henry CookeI have a video sequence that I'd like to skip to specific frames at playback-time (my player is implemented using AVPlayer in iOS, but that's incidental). Since these frames will fall at unpredictable intervals, I can't use the standard "keyframe every N frames/seconds" functionality present in most video encoders. I do, however, know the target frames in advance.
In order to do this skipping as efficiently as possible, I need to force the target frames to be i-frames at encode time. Ideally in some kind of GUI which would let me scrub to a frame, mark it as a keyframe, and then (re)encode my video.
If such a tool isn't available, I have the feeling this could probably be done by rolling a custom encoder with libavcodec, but I'd rather use a higher-level (and preferably scriptable) tool to do the job if a GUI isn't possible. Is this the kind of task ffmpeg or mencoder can be bent to?
Does anybody have a technique for doing this? Also, it's entirely possible that this is an impossible task because of some fundamental ignorance I have of the h.264 codec. If so, please do put me right.