Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Cannot get ffmpeg2.3.3 to work with Opencv2.4.9
6 septembre 2014, par Siddharthan P RI need to open a video file in opencv2.4.9. I used the following code and I got the output : !!! Sorry cant find the video file !!!.
So I figured I need to install ffmpeg first then install opencv. So I Uninstalled opencv and ffmpeg then tried to install ffmpeg 2.3.3 properly. Here are the methods i tried to install ffmpeg.
Method 1: sudo apt-get install ffmpeg.
Method 2: Download (HTTP): http://ffmpeg.org/releases/ffmpeg-2.3.3.tar.bz2
Then i typed the following in the terminal after cd to the extracted folder.
sed -i 's/-lflite"/-lflite -lasound"/' configure && ./configure --prefix=/usr \ --enable-gpl \ --enable-version3 \ --enable-nonfree \ --disable-static \ --enable-shared \ --disable-debug \ --enable-libass \ --enable-libfdk-aac \ --enable-libmp3lame \ --enable-libtheora \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-x11grab && make && gcc tools/qt-faststart.c -o tools/qt-faststart
Though Method 1 works fine (in just installing ffmpeg), the problem with Method 1 is that i cannot use "./configure --enable-shared" anywhere because i cannot locate the file "configure".
The problem with method 2 is that it says
-ERROR: libass not found, after installing libass it says -ERROR: libfdk-aac-0.1.3 not found, then -ERROR: lame-3.8 not found, then -ERROR: libtheora not found, here i really got tired of installing all these packages. I stopped.
I am really confused how to pull this off: with Method 1 or Method 2 (both seem not to work ). Can i change the ./ configure using method 1?
Any help would be greatly appreciated.
#include #include int main(int argc, char** argv) { cvNamedWindow("xample2", CV_WINDOW_AUTOSIZE); CvCapture* capture = cvCreateFileCapture( "1.mp4" ); if (!capture) { std::cout << "!!! Sorry cant find the video file !!!\n"; return -1; } IplImage* frame; while (1) { frame = cvQueryFrame(capture); if(!frame) break; cvShowImage("xample2", frame); char c = cvWaitKey(33); if (c == 27) break; } cvReleaseCapture(&capture); cvDestroyWindow("xample2"); }
-
OpenCV cv2 not working in Windows 7
6 septembre 2014, par Subhendu Sinha ChaudhuriI have a Windows 7 SP1 64 Bit machine with open cv2.4.9 installed and python 2.7.6 installed. I use pre compiled version of opencv
The following code works perfectly for me
import cv2.cv as cv import time cv.NamedWindow("camera", 0) capture = cv.CaptureFromCAM(0) while True: img = cv.QueryFrame(capture) cv.ShowImage("camera", img) if cv.WaitKey(10) == 27: break cv.DestroyAllWindows()
Now when I try to use this code
import cv2 import numpy as np cam = cv2.VideoCapture(0) s, img = cam.read() winName = "Movement Indicator" cv2.namedWindow(winName, cv2.CV_WINDOW_AUTOSIZE) while s: cv2.imshow( winName,img ) s, img = cam.read() key = cv2.waitKey(10) if key == 27: cv2.destroyWindow(winName) break print "Goodbye"
The window is opened , the camera is initialized (as camera lights are on) , but nothing is displayed and the window closes and the program exits.
WHERE am I going wrong??
QUESTION 2 Can any one also suggest me how to capture live video stream from my Linux machine 192.168.1.3 . The stream is being generated by ffmpeg.
The video stream can be opened in web browser. But I want to capture it with opencv and python.
-
Save MJPEG video stream to a raw file
6 septembre 2014, par user824963I've a cheap IP cam, and i need to save the video stream inside a single file.
i've tried to execute the wget command towards the stream' url and the result was a file with this syntax:
--object-ipcamera Content-Type:image/jpeg Content-Length:8012 ÿØÿà [JPEG IMAGE CHARACTERS] ÿÙ --object-ipcamera Content-Type:image/jpeg Content-Length:8012 ÿØÿàÆÿ [JPEG IMAGE CHARACTERS] ÿÿÿÙ --object-ipcamera Content-Type:image/jpeg Content-Length:8036
Since i need to store the video stream, is mp4 a proper format to do that? What if mp4 file being truncated?
I tried with ffmpeg:
ffmpeg -i http://
:99/vieostream.cgi out.mp4 the output was
[ingenient @ 0x1f51600] Could not find codec parameters for stream 0 (Video: mjpeg): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options [ingenient @ 0x1f51600] Estimating duration from bitrate, this may be inaccurate http://aaa@192.168.0.104:99/vieostream.cgi: could not find codec parameters
and even setting these parameter to the max allowed value there is still the some output.
I want also say that if i open the video url using VLC GUI, the video stream immediately comes out, so there is a way to auto-detect the video parameters?
Note: my server has a small CPU
-
GStreamer force decodebin2 output type
6 septembre 2014, par user975326I'm trying to write a program in C which replicates the pipeline:
gst-launch -v filesrc location="bbb.mp4" ! decodebin2 ! ffmpegcolorspace ! autovideosink
DecodeBin2 has a dynamic pad and I've attached a callback to handle its creation. I am unable to link it to ffmpegcolorspace however because the pad capability is always video/quicktime. I would like it to be video/x-raw-yuv or something else which is compatible with ffmpegcolorspace.
Is this possible to force/select the output type of decodebin2?
Thanks.
EDIT: Please do not recommend playbin. I'm trying to learn how how to make pipelines.
-
ffmpeg silence detect and removal
6 septembre 2014, par ZahliiI am trying to use the following command with the latest ffmpeg build to remove silence from my .mp3 files:
ffmpeg -i SILENCE.mp3 -af silencedetect=n=-50dB:d=1 -y -ab 192k SILENCE_OUT.mp3
However, the following output is produced:
ffmpeg version N-66154-g1654ca7 Copyright (c) 2000-2014 the FFmpeg developers built on Sep 5 2014 22:10:38 with gcc 4.8.3 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable- libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib libavutil 54. 7.100 / 54. 7.100 libavcodec 56. 1.100 / 56. 1.100 libavformat 56. 4.100 / 56. 4.100 libavdevice 56. 0.100 / 56. 0.100 libavfilter 5. 1.100 / 5. 1.100 libswscale 3. 0.100 / 3. 0.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 0.100 / 53. 0.100 Input #0, mp3, from 'SILENCE.mp3': Metadata: title : Snowblind (Featuring Tasha Baxter) artist : Au5 album : Snowblind (Featuring Tasha Baxter) genre : Electronica performer : Au5 track : 1/1 date : 2014 album_artist : Au5,Tasha Baxter major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : Lavf55.42.100 Duration: 00:05:50.80, start: 0.025057, bitrate: 192 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 192 kb/s Output #0, mp3, to 'SILENCE_OUT.mp3': Metadata: TIT2 : Snowblind (Featuring Tasha Baxter) TPE1 : Au5 TALB : Snowblind (Featuring Tasha Baxter) TCON : Electronica TPE3 : Au5 TRCK : 1/1 TDRL : 2014 TPE2 : Au5,Tasha Baxter major_brand : mp42 minor_version : 0 compatible_brands: isommp42 TSSE : Lavf56.4.100 Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p, 192 kb/s Metadata: encoder : Lavc56.1.100 libmp3lame Stream mapping: Stream #0:0 -> #0:0 (mp3 (native) -> mp3 (libmp3lame)) Press [q] to stop, [?] for help [silencedetect @ 0000000004398f40] silence_start: -0.00628118 [silencedetect @ 0000000004398f40] silence_end: 3.21413 | silence_duration: 3.22 041 [silencedetect @ 0000000004398f40] silence_start: 343.844 [libmp3lame @ 00000000043b2940] Trying to remove 1152 samples, but the queue is empty size= 8223kB time=00:05:50.79 bitrate= 192.0kbits/s video:0kB audio:8222kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.011485%
The generated audio file however still has the original length without any silence removed. See the following images:
Any help is appreciated!
EDIT: Alright, silence detect is only DETECTING the silence. Not removing it. I will try to post a solution for this.