Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Crash with opencv video intitialisation
21 novembre 2013, par IngeborgI have the problem which is described here.
The extension i have already set correct. What i have done regarding the suggestet Points on the link:
Point 1: I have looked in my cmake file and ffmpeg, libavutil etc is all chosen.
Point 2: I thought all files are installed automatically in usr/src if you don't change it, isn't it?
Point 3: It is a new installation. But btw. how can i deinstall the lib?
Point 4: Shouldn't be the problem.
Thx in advance
Further infos: Opensuse 12.3 Opencv-2.4.3 Qt4 Environment
C++ Commands used last:
VW.open(vsm, CV_FOURCC('F','L','V','1'), 25, vidImg.size(),!(vidImg.channels() == 1));
Filename in vsm: /home/Ingeborg/DA/videos/IMG-2013-11-19-22-3-5.avi
-
ffmpeg udp/tcp stream receive frame not same as sent
21 novembre 2013, par vivienlwtI am streaming a video on raspberrypi using command:
ffmpeg -re -threads 2 -i sample_video.m2v -f mpegts - | \ ffmpeg -f mpegts -i - -c copy -f mpegts udp://192.168.1.100:12345
The remote PC with 192.168.1.100 uses ffmpeg library to listen to the input stream. For example:
informat = ffmpeg::av_find_input_format("mpegts"); avformat_open_input(&pFormatCtx, "udp://192.168.1.100:12345", informat, options);
However, when I compute the hash value of each decoded frame on two sides (i.e. raspberrypi and PC), they DON'T MATCH at all. A weird thing is, among ~2000 frames, there are in total ~10 frames whose hash value are the same on the sender and receiver side. The match result look like this:
00000....00011000...00011110000...000
where 0 indicates non-match and 1 indicates match. The matched frame appeared 2~6 in sequence and appeared rarely while most of the other frames has different hash value.
The hash is computed on the frame data buffer extracted using
avpicture_layout()
. On the Pi side, I just stream the video to a local port and there's a local process using the same code to decode and hash the frames:ffmpeg -re -threads 2 -i sample_video.m2v -f mpegts - | \ ffmpeg -f mpegts -i - -c copy -f mpegts udp://localhost:12345 ...
The streaming source raspberry pi, is connected directly to the PC using cable. I don't think it is a packet loss problem. Because, first, I rerun the same process several times and the hash value of the received frames are the same (otherwise the result should be different because packet loss is probabilistic). Secondly, I even try to stream on tcp://192.168.1.100:12345 (and "tcp://192.168.1.100:12345?listen" on PC), and the received frame hash are still the same - different than the hash result on the Pi.
So, does anyone know why the streaming to a remote address will yield different decoded frames? Maybe I am missing some details.
Thanks in advance!!
-
Bitmap images to WEBM video encoding
21 novembre 2013, par AnkushI am trying to encode bitmap images to webm video,but generated video is not playable Here is code I am using,code works fine for H624. While encoding console windows shows: [libvpx @ 009b2f60] v1.2.0 there is no webm string in produced video file. Any clue? ( I am newbie for FFMPEG API )
void create_from_bmp() { CFile file[5]; BYTE *szTxt[5]; int nWidth = 0; int nHeight= 0; int nDataLen=0; int nLen; CString csFileName; for (int fileI = 1; fileI <= 5; fileI ++) { csFileName.Format("e:\\pics\\%d.bmp",fileI); file[fileI - 1].Open(csFileName,CFile::modeRead | CFile::typeBinary); nLen = file[fileI - 1].GetLength(); szTxt[fileI -1] = new BYTE[nLen]; file[fileI - 1].Read(szTxt[fileI - 1], nLen); file[fileI - 1].Close(); //BMP bmi;//BITMAPINFO bmi; //int nHeadLen = sizeof(BMP); BITMAPFILEHEADER bmpFHeader; BITMAPINFOHEADER bmpIHeader; memcpy(&bmpFHeader,szTxt[fileI -1],sizeof(BITMAPFILEHEADER)); int nHeadLen = bmpFHeader.bfOffBits - sizeof(BITMAPFILEHEADER); memcpy(&bmpIHeader,szTxt[fileI - 1]+sizeof(BITMAPFILEHEADER),nHeadLen); nWidth = bmpIHeader.biWidth;// 464;// bmi.bmpInfo.bmiHeader.biWidth;// ; nHeight = bmpIHeader.biHeight;//362;// bmi.bmpInfo.bmiHeader.biHeight;// ; szTxt[fileI - 1] += bmpFHeader.bfOffBits; nDataLen = nLen-bmpFHeader.bfOffBits; } av_register_all(); avcodec_register_all(); AVFrame *m_pRGBFrame = new AVFrame[1]; //RGB AVFrame *m_pYUVFrame = new AVFrame[1];; //YUV AVCodecContext *c= NULL; AVCodecContext *in_c= NULL; AVCodec *pCodecH264; uint8_t * yuv_buff;// pCodecH264 = avcodec_find_encoder(CODEC_ID_VP8); if(!pCodecH264) { fprintf(stderr, "h264 codec not found\n"); exit(1); } c= avcodec_alloc_context3(pCodecH264); c->bit_rate = 3000000;// put sample parameters c->width =nWidth;// c->height = nHeight;// // frames per second AVRational rate; rate.num = 1; rate.den = 5; //5 frames per sec c->time_base= rate;//(AVRational){1,25}; c->gop_size = 10; // emit one intra frame every ten frames //emit one iframe per sec c->max_b_frames=0; // c->thread_count = 1; c->pix_fmt = PIX_FMT_YUV420P;//PIX_FMT_RGB24; c->codec_id=CODEC_ID_VP8; //av_opt_set(c->priv_data, /*"preset"*/"libvpx-1080p.ffpreset", /*"slow"*/NULL, 0); if(avcodec_open2(c,pCodecH264,NULL)<0) printf("Cant open codec"); int size = c->width * c->height; yuv_buff = (uint8_t *) malloc((size * 3) / 2); // size for YUV 420 uint8_t * rgb_buff = new uint8_t[nDataLen]; int outbuf_size=400000; uint8_t * outbuf= (uint8_t*)malloc(outbuf_size); int u_size = 0; FILE *f=NULL; char * filename = "e:\\pics\\myData.h264"; f = fopen(filename, "wb"); if (!f) { printf( "could not open %s\n", filename); exit(1); } //SwsContext SwsContext * scxt = sws_getContext(c->width,c->height,PIX_FMT_BGR24,c->width,c->height,PIX_FMT_YUV420P,SWS_POINT,NULL,NULL,NULL); AVPacket avpkt; //AVFrame *pTFrame=new AVFrame for (int i=0;i<60;++i) { //AVFrame *m_pYUVFrame = new AVFrame[1]; int index = (i / 5) % 5; memcpy(rgb_buff,szTxt[index],nDataLen); avpicture_fill((AVPicture*)m_pRGBFrame, (uint8_t*)rgb_buff, PIX_FMT_RGB24, nWidth, nHeight); avpicture_fill((AVPicture*)m_pYUVFrame, (uint8_t*)yuv_buff, PIX_FMT_YUV420P, nWidth, nHeight); m_pRGBFrame->data[0] += m_pRGBFrame->linesize[0] * (nHeight - 1); m_pRGBFrame->linesize[0] *= -1; m_pRGBFrame->data[1] += m_pRGBFrame->linesize[1] * (nHeight / 2 - 1); m_pRGBFrame->linesize[1] *= -1; m_pRGBFrame->data[2] += m_pRGBFrame->linesize[2] * (nHeight / 2 - 1); m_pRGBFrame->linesize[2] *= -1; sws_scale(scxt,m_pRGBFrame->data,m_pRGBFrame->linesize,0,c->height,m_pYUVFrame->data,m_pYUVFrame->linesize); int got_packet_ptr = 0; av_init_packet(&avpkt); avpkt.data = outbuf; avpkt.size = outbuf_size; u_size = avcodec_encode_video2(c, &avpkt, m_pYUVFrame, &got_packet_ptr); if (u_size == 0) { fwrite(avpkt.data, 1, avpkt.size, f); } } fclose(f); delete []m_pRGBFrame; delete []m_pYUVFrame; delete []rgb_buff; free(outbuf); avcodec_close(c); av_free(c); }
I want to use this code to record screen by encoding screenshots. what fps,gop size or other parameters i can use to reduce size of video.
-
Audio conversion with ffmpeg on cygwin fails
21 novembre 2013, par laurtI have installed ffmpeg on cygwin from source code. I need to convert mp3 files to raw audio, but it fails with the following error message:
Assertion !link->frame_requested || link->flags & FF_LINK_FLAG_REQUEST_LOOP failed at libavfilter/avfilter.c:360
Do I have some codec missing? Any help would be appreciated.
Here's the full output of ffmpeg (audio metadata snipped):
$ ffmpeg -i 2quickstart.mp3 -ac 1 -ar 11025 -f s16le -t 20 -ss 10 2quickstart.raw ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers built on Nov 20 2013 13:26:12 with gcc 4.8.2 (GCC) configuration: libavutil 52. 48.101 / 52. 48.101 libavcodec 55. 39.101 / 55. 39.101 libavformat 55. 19.104 / 55. 19.104 libavdevice 55. 5.100 / 55. 5.100 libavfilter 3. 90.100 / 3. 90.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 [mp3 @ 0x80022040] Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from '2quickstart.mp3': Metadata: --snip-- Duration: 00:03:37.87, start: 0.000000, bitrate: 255 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 256 kb/s Output #0, s16le, to '2quickstart.raw': Metadata: --snip-- encoder : Lavf55.19.104 Stream #0:0: Audio: pcm_s16le, 11025 Hz, mono, s16, 176 kb/s Stream mapping: Stream #0:0 -> #0:0 (mp3 -> pcm_s16le) Press [q] to stop, [?] for help Assertion !link->frame_requested || link->flags & FF_LINK_FLAG_REQUEST_LOOP failed at libavfilter/avfilter.c:360 Aborted (core dumped)
-
linphone on windows building error
21 novembre 2013, par chhameedi have downloaded the linphone for Android from Github. i have also followed all the instructions in readme file. the problem is that when i run
ndk-build
command it produce below error .Android NDK: ERROR:jni/..//submodules/externals/build/ffmpeg/Android.mk:avutil-linphone: LOCAL_SRC_FILES points to a missing file Android NDK: Check that jni/..//submodules/externals/build/ffmpeg/arm/libavutil/libavutil-linphone-arm.so exists or that its path is correct /cygdrive/c/development/android-ndk-r9b/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.
what this error mean ? & how can i resolve this?
i already spent many hours to searchout this error but no success... my OS is window 7 & i used cygwin for commands.i have found same question on SO
Android NDK error when using FFmpeg in Android?it says
Basically problem was with ffmpeg lib.I was not able to compile ffmpeg lib on Windows 7. I switched to Ubuntu & tried AppUnite & after spending so many hours it was working.
is it not possible to build linphone on windows ???