From adjiev.dmitry at gmail.com Fri Aug 1 03:01:31 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 1 Aug 2014 05:01:31 +0400 Subject: [Libav-user] avcodec_encode_video2 C++problem Message-ID: Hello. I have a problem with avcodec_encode_video2. I send h263 video stream to network, this code works when I compile it with C, but when I try to use C++ classes it crashes. Can anyone help me? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Fri Aug 1 03:08:34 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 1 Aug 2014 05:08:34 +0400 Subject: [Libav-user] avcodec_encode_video2 C++problem In-Reply-To: References: Message-ID: if (open_url(argv[1], &stream) == 0) { AVFrame* pic = av_frame_alloc(); int i, size, x, y, outbuf_size; uint8_t *outbuf, *picture_buf; // alloc image and output buffer outbuf_size = 100000; outbuf = malloc(outbuf_size); size = VIDEO_WIDTH * VIDEO_HEIGHT; picture_buf = malloc((size * 3) / 2); // size for YUV 420 pic->data[0] = picture_buf; pic->data[1] = pic->data[0] + size; pic->data[2] = pic->data[1] + size / 4; pic->linesize[0] = VIDEO_WIDTH; pic->linesize[1] = VIDEO_WIDTH / 2; pic->linesize[2] = VIDEO_WIDTH / 2; AVPacket packet; av_init_packet(&packet); i = 0; int ret = avformat_write_header(stream.output_format_context, NULL); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output file\n"); return ret; } while (!stopped) { // encode 1 second of video for(i = 0; i < 25; i++) { // prepare a dummy image // for(y = 0; y < VIDEO_HEIGHT; y++) { for(x = 0; x < VIDEO_WIDTH; x++) { pic->data[0][y * pic->linesize[0] + x] = x + y + i * 3; } } // Cb and Cr for(y=0;ydata[1][y * pic->linesize[1] + x] = 128 + y + i * 2; pic->data[2][y * pic->linesize[2] + x] = 64 + x + i * 5; } } int got_packet_ptr; avcodec_encode_video2(stream.stream->codec, &packet, pic, &got_packet_ptr); int stream_index = 0; // prepare packet for muxing packet.stream_index = stream_index; packet.dts = av_rescale_q_rnd(packet.dts, stream.output_format_context->streams[stream_index]->codec->time_base, stream.output_format_context->streams[stream_index]->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); packet.pts = av_rescale_q_rnd(packet.pts, stream.output_format_context->streams[stream_index]->codec->time_base, stream.output_format_context->streams[stream_index]->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); packet.duration = av_rescale_q(packet.duration, stream.output_format_context->streams[stream_index]->codec->time_base, stream.output_format_context->streams[stream_index]->time_base); if (got_packet_ptr) { av_interleaved_write_frame(stream.output_format_context, &packet); } else break; usleep(2); } } 2014-08-01 5:01 GMT+04:00 Dmitry Adjiev : > Hello. > I have a problem with avcodec_encode_video2. > I send h263 video stream to network, this code works when I compile it > with C, but when I try to use C++ classes it crashes. > Can anyone help me? > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Fri Aug 1 03:11:40 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 1 Aug 2014 05:11:40 +0400 Subject: [Libav-user] avcodec_encode_video2 C++problem In-Reply-To: References: Message-ID: I solved the issue. I don't know why. but in C++ buffer size outbuf_size = 100000; was too small, so increase of buffer size solves the problem. Thanks for everyone who read it 2014-08-01 5:08 GMT+04:00 Dmitry Adjiev : > if (open_url(argv[1], &stream) == 0) { > > AVFrame* pic = av_frame_alloc(); > int i, size, x, y, outbuf_size; > uint8_t *outbuf, *picture_buf; > > // alloc image and output buffer > outbuf_size = 100000; > outbuf = malloc(outbuf_size); > size = VIDEO_WIDTH * VIDEO_HEIGHT; > picture_buf = malloc((size * 3) / 2); // size for YUV 420 > > pic->data[0] = picture_buf; > pic->data[1] = pic->data[0] + size; > pic->data[2] = pic->data[1] + size / 4; > pic->linesize[0] = VIDEO_WIDTH; > pic->linesize[1] = VIDEO_WIDTH / 2; > pic->linesize[2] = VIDEO_WIDTH / 2; > AVPacket packet; > av_init_packet(&packet); > i = 0; > > int ret = avformat_write_header(stream.output_format_context, > NULL); > > if (ret < 0) { > av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output > file\n"); > return ret; > } > > while (!stopped) { > // encode 1 second of video > for(i = 0; i < 25; i++) { > // prepare a dummy image > // > for(y = 0; y < VIDEO_HEIGHT; y++) { > > for(x = 0; x < VIDEO_WIDTH; x++) { > pic->data[0][y * pic->linesize[0] + x] = x + y + i > * 3; > } > } > > // Cb and Cr > for(y=0;y for(x=0;x pic->data[1][y * pic->linesize[1] + x] = 128 + y + > i * 2; > pic->data[2][y * pic->linesize[2] + x] = 64 + x + > i * 5; > } > } > > int got_packet_ptr; > avcodec_encode_video2(stream.stream->codec, &packet, pic, > &got_packet_ptr); > int stream_index = 0; > // prepare packet for muxing > packet.stream_index = stream_index; > packet.dts = av_rescale_q_rnd(packet.dts, > > stream.output_format_context->streams[stream_index]->codec->time_base, > > stream.output_format_context->streams[stream_index]->time_base, > AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); > packet.pts = av_rescale_q_rnd(packet.pts, > > stream.output_format_context->streams[stream_index]->codec->time_base, > > stream.output_format_context->streams[stream_index]->time_base, > AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); > packet.duration = av_rescale_q(packet.duration, > > stream.output_format_context->streams[stream_index]->codec->time_base, > > stream.output_format_context->streams[stream_index]->time_base); > > if (got_packet_ptr) { > > av_interleaved_write_frame(stream.output_format_context, &packet); > } else > break; > > usleep(2); > } > } > > > 2014-08-01 5:01 GMT+04:00 Dmitry Adjiev : > > Hello. >> I have a problem with avcodec_encode_video2. >> I send h263 video stream to network, this code works when I compile it >> with C, but when I try to use C++ classes it crashes. >> Can anyone help me? >> -- >> Regards, >> Dmitry >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From michaelni at gmx.at Fri Aug 1 03:16:31 2014 From: michaelni at gmx.at (Michael Niedermayer) Date: Fri, 1 Aug 2014 03:16:31 +0200 Subject: [Libav-user] FFmpeg and OPW Message-ID: <20140801011631.GJ4649@nb4> Hi all OPW (Outreach Program for Women) is twice per year (compared to google summer of code which is just once a year) FFmpeg can participate in the next round but we need to fund at least 1 intern/student (6250 USD) for that. OPW is not run by a large corporation with deep pockets. Thus my mail here, if you are/represent a company or know one who does and who uses and benefits from FFmpeg, and has the financial resources, please consider to donate or ask/forward this mail. Why should you donate? Well the money will be used to fund a intern working on and improving FFmpeg. (assuming there will be a intern who wants to work on FFmpeg in OPW) Maybe it will be a failure, maybe it will lead to some minor improvments in FFmpeg, maybe it will majorly improve FFmpeg. And maybe we gain a new long term contributor. And improvments in FFmpeg again benefit you as company or user of FFmpeg. Also if you donate 6250$ to OPW for ffmpeg you get your logo at https://gnome.org/opw/ Either way for FFmpeg to be part of the next OPW round we need at least 1 payment commitment of 6250 USD by the end of August at the latest Please keep opw at ffmpeg.org in CC if you have questions or want to donate. PS: there are 2 ways to donate, one is directly to OPW/Gnome, this way you get your logo at gnome.org/opw if you donate at least 6250USD or through https://co.clickandpledge.com/advanced/default.aspx?wid=56226 for smaller sums. PS2: in case we get more than 6250$, on our SPI (clickandpledge) account the additional funding may be used for future ffmpeg-OPW rounds or things similar in spirit to OPW and GSOC. Thanks! -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: From adjiev.dmitry at gmail.com Fri Aug 1 04:13:47 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 1 Aug 2014 06:13:47 +0400 Subject: [Libav-user] avcodec_encode_video2 C++problem In-Reply-To: References: Message-ID: How can I get link to this iscussion for snding to others? 2014-08-01 5:11 GMT+04:00 Dmitry Adjiev : > I solved the issue. I don't know why. but in C++ buffer size outbuf_size = > 100000; was too small, so increase of buffer size solves the problem. > Thanks for everyone who read it > > > 2014-08-01 5:08 GMT+04:00 Dmitry Adjiev : > > if (open_url(argv[1], &stream) == 0) { >> >> AVFrame* pic = av_frame_alloc(); >> int i, size, x, y, outbuf_size; >> uint8_t *outbuf, *picture_buf; >> >> // alloc image and output buffer >> outbuf_size = 100000; >> outbuf = malloc(outbuf_size); >> size = VIDEO_WIDTH * VIDEO_HEIGHT; >> picture_buf = malloc((size * 3) / 2); // size for YUV 420 >> >> pic->data[0] = picture_buf; >> pic->data[1] = pic->data[0] + size; >> pic->data[2] = pic->data[1] + size / 4; >> pic->linesize[0] = VIDEO_WIDTH; >> pic->linesize[1] = VIDEO_WIDTH / 2; >> pic->linesize[2] = VIDEO_WIDTH / 2; >> AVPacket packet; >> av_init_packet(&packet); >> i = 0; >> >> int ret = avformat_write_header(stream.output_format_context, >> NULL); >> >> if (ret < 0) { >> av_log(NULL, AV_LOG_ERROR, "Error occurred when opening >> output file\n"); >> return ret; >> } >> >> while (!stopped) { >> // encode 1 second of video >> for(i = 0; i < 25; i++) { >> // prepare a dummy image >> // >> for(y = 0; y < VIDEO_HEIGHT; y++) { >> >> for(x = 0; x < VIDEO_WIDTH; x++) { >> pic->data[0][y * pic->linesize[0] + x] = x + y + >> i * 3; >> } >> } >> >> // Cb and Cr >> for(y=0;y> for(x=0;x> pic->data[1][y * pic->linesize[1] + x] = 128 + y >> + i * 2; >> pic->data[2][y * pic->linesize[2] + x] = 64 + x + >> i * 5; >> } >> } >> >> int got_packet_ptr; >> avcodec_encode_video2(stream.stream->codec, &packet, pic, >> &got_packet_ptr); >> int stream_index = 0; >> // prepare packet for muxing >> packet.stream_index = stream_index; >> packet.dts = av_rescale_q_rnd(packet.dts, >> >> stream.output_format_context->streams[stream_index]->codec->time_base, >> >> stream.output_format_context->streams[stream_index]->time_base, >> AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); >> packet.pts = av_rescale_q_rnd(packet.pts, >> >> stream.output_format_context->streams[stream_index]->codec->time_base, >> >> stream.output_format_context->streams[stream_index]->time_base, >> AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); >> packet.duration = av_rescale_q(packet.duration, >> >> stream.output_format_context->streams[stream_index]->codec->time_base, >> >> stream.output_format_context->streams[stream_index]->time_base); >> >> if (got_packet_ptr) { >> >> av_interleaved_write_frame(stream.output_format_context, &packet); >> } else >> break; >> >> usleep(2); >> } >> } >> >> >> 2014-08-01 5:01 GMT+04:00 Dmitry Adjiev : >> >> Hello. >>> I have a problem with avcodec_encode_video2. >>> I send h263 video stream to network, this code works when I compile it >>> with C, but when I try to use C++ classes it crashes. >>> Can anyone help me? >>> -- >>> Regards, >>> Dmitry >>> >> >> >> >> -- >> Regards, >> Dmitry >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Fri Aug 1 04:16:01 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 1 Aug 2014 06:16:01 +0400 Subject: [Libav-user] avcodec_encode_video2 C++problem In-Reply-To: References: Message-ID: I found it here: https://ffmpeg.org/pipermail/libav-user/2014-August/author.html Sorry for flooding 2014-08-01 6:13 GMT+04:00 Dmitry Adjiev : > How can I get link to this iscussion for snding to others? > > > 2014-08-01 5:11 GMT+04:00 Dmitry Adjiev : > > I solved the issue. I don't know why. but in C++ buffer size outbuf_size = >> 100000; was too small, so increase of buffer size solves the problem. >> Thanks for everyone who read it >> >> >> 2014-08-01 5:08 GMT+04:00 Dmitry Adjiev : >> >> if (open_url(argv[1], &stream) == 0) { >>> >>> AVFrame* pic = av_frame_alloc(); >>> int i, size, x, y, outbuf_size; >>> uint8_t *outbuf, *picture_buf; >>> >>> // alloc image and output buffer >>> outbuf_size = 100000; >>> outbuf = malloc(outbuf_size); >>> size = VIDEO_WIDTH * VIDEO_HEIGHT; >>> picture_buf = malloc((size * 3) / 2); // size for YUV 420 >>> >>> pic->data[0] = picture_buf; >>> pic->data[1] = pic->data[0] + size; >>> pic->data[2] = pic->data[1] + size / 4; >>> pic->linesize[0] = VIDEO_WIDTH; >>> pic->linesize[1] = VIDEO_WIDTH / 2; >>> pic->linesize[2] = VIDEO_WIDTH / 2; >>> AVPacket packet; >>> av_init_packet(&packet); >>> i = 0; >>> >>> int ret = avformat_write_header(stream.output_format_context, >>> NULL); >>> >>> if (ret < 0) { >>> av_log(NULL, AV_LOG_ERROR, "Error occurred when opening >>> output file\n"); >>> return ret; >>> } >>> >>> while (!stopped) { >>> // encode 1 second of video >>> for(i = 0; i < 25; i++) { >>> // prepare a dummy image >>> // >>> for(y = 0; y < VIDEO_HEIGHT; y++) { >>> >>> for(x = 0; x < VIDEO_WIDTH; x++) { >>> pic->data[0][y * pic->linesize[0] + x] = x + y + >>> i * 3; >>> } >>> } >>> >>> // Cb and Cr >>> for(y=0;y>> for(x=0;x>> pic->data[1][y * pic->linesize[1] + x] = 128 + y >>> + i * 2; >>> pic->data[2][y * pic->linesize[2] + x] = 64 + x >>> + i * 5; >>> } >>> } >>> >>> int got_packet_ptr; >>> avcodec_encode_video2(stream.stream->codec, &packet, >>> pic, &got_packet_ptr); >>> int stream_index = 0; >>> // prepare packet for muxing >>> packet.stream_index = stream_index; >>> packet.dts = av_rescale_q_rnd(packet.dts, >>> >>> stream.output_format_context->streams[stream_index]->codec->time_base, >>> >>> stream.output_format_context->streams[stream_index]->time_base, >>> AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); >>> packet.pts = av_rescale_q_rnd(packet.pts, >>> >>> stream.output_format_context->streams[stream_index]->codec->time_base, >>> >>> stream.output_format_context->streams[stream_index]->time_base, >>> AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); >>> packet.duration = av_rescale_q(packet.duration, >>> >>> stream.output_format_context->streams[stream_index]->codec->time_base, >>> >>> stream.output_format_context->streams[stream_index]->time_base); >>> >>> if (got_packet_ptr) { >>> >>> av_interleaved_write_frame(stream.output_format_context, &packet); >>> } else >>> break; >>> >>> usleep(2); >>> } >>> } >>> >>> >>> 2014-08-01 5:01 GMT+04:00 Dmitry Adjiev : >>> >>> Hello. >>>> I have a problem with avcodec_encode_video2. >>>> I send h263 video stream to network, this code works when I compile it >>>> with C, but when I try to use C++ classes it crashes. >>>> Can anyone help me? >>>> -- >>>> Regards, >>>> Dmitry >>>> >>> >>> >>> >>> -- >>> Regards, >>> Dmitry >>> >> >> >> >> -- >> Regards, >> Dmitry >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Fri Aug 1 04:20:41 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 1 Aug 2014 06:20:41 +0400 Subject: [Libav-user] Encoding FLOAT PCM to OGG using libav In-Reply-To: <20140731233320.6ca76fc6@debian> References: <20140731233320.6ca76fc6@debian> Message-ID: Try libavfilter, please see transcoding.c again for sream conversions, btw keep in mind your code may broke during porting from C to C++ or or vice versa. Just FYI: https://ffmpeg.org/pipermail/libav-user/2014-August/author.html 2014-08-01 1:33 GMT+04:00 wm4 : > On Thu, 31 Jul 2014 09:24:38 +0200 > Charles-Henri DUMALIN wrote: > > > I am currently trying to convert a raw PCM Float buffer to an OGG encoded > > file. I tried several library to do the encoding process and I finally > > chose libavcodec. > > > > What I precisely want to do is get the float buffer ([-1;1]) provided by > my > > audio library and turn it to a char buffer of encoded ogg data. > > > > I managed to encode the float buffer to a buffer of encoded MP2 with this > > (proof of concept) code: > > > > static int frameEncoded; > > > > FILE *file; > > > > int main(int argc, char *argv[]) > > { > > file = fopen("file.ogg", "w+"); > > > > long ret; > > > > avcodec_register_all(); > > > > codec = avcodec_find_encoder(AV_CODEC_ID_MP2); > > if (!codec) { > > fprintf(stderr, "codec not found\n"); > > exit(1); > > } > > > > c = avcodec_alloc_context3(NULL); > > > > c->bit_rate = 256000; > > c->sample_rate = 44100; > > c->channels = 2; > > c->sample_fmt = AV_SAMPLE_FMT_S16; > > c->channel_layout = AV_CH_LAYOUT_STEREO; > > > > /* open it */ > > if (avcodec_open2(c, codec, NULL) < 0) { > > fprintf(stderr, "Could not open codec\n"); > > exit(1); > > } > > > > > > /* frame containing input raw audio */ > > frame = av_frame_alloc(); > > if (!frame) { > > fprintf(stderr, "Could not allocate audio frame\n"); > > exit(1); > > } > > > > frame->nb_samples = c->frame_size; > > frame->format = c->sample_fmt; > > frame->channel_layout = c->channel_layout; > > > > /* the codec gives us the frame size, in samples, > > * we calculate the size of the samples buffer in bytes */ > > int buffer_size = av_samples_get_buffer_size(NULL, c->channels, > > c->frame_size, > > c->sample_fmt, 0); > > if (buffer_size < 0) { > > fprintf(stderr, "Could not get sample buffer size\n"); > > exit(1); > > } > > samples = av_malloc(buffer_size); > > if (!samples) { > > fprintf(stderr, "Could not allocate %d bytes for samples > buffer\n", > > buffer_size); > > exit(1); > > } > > /* setup the data pointers in the AVFrame */ > > ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, > > (const uint8_t*)samples, buffer_size, > 0); > > if (ret < 0) { > > fprintf(stderr, "Could not setup audio frame\n"); > > exit(1); > > } > > } > > > > void myLibraryCallback(float *inbuffer, unsigned int length) > > { > > for(int j = 0; j < (2 * length); j++) { > > if(frameEncoded >= (c->frame_size *2)) { > > int avret, got_output; > > > > av_init_packet(&pkt); > > pkt.data = NULL; // packet data will be allocated by the > encoder > > pkt.size = 0; > > > > avret = avcodec_encode_audio2(c, &pkt, frame, &got_output); > > if (avret < 0) { > > fprintf(stderr, "Error encoding audio frame\n"); > > exit(1); > > } > > if (got_output) { > > fwrite(pkt.data, 1, pkt.size, file); > > av_free_packet(&pkt); > > } > > > > frameEncoded = 0; > > } > > > > samples[frameEncoded] = inbuffer[j] * SHRT_MAX; > > frameEncoded++; > > } > > } > > > > > > The code is really simple, I initialize libavencode the usual way, then > my > > audio library sends me processed PCM FLOAT [-1;1] interleaved at 44.1Khz > > and the number of floats (usually 1024) in the inbuffer for each channel > (2 > > for stereo). So usually, inbuffer contains 2048 floats. > > > > That was easy since I just needed here to convert my PCM to 16P, both > > interleaved. Moreover it is possible to code a 16P sample on a single > char. > > > > Now I would like to apply this to OGG which needs a sample format of > > AV_SAMPLE_FMT_FLTP. Since my native format is AV_SAMPLE_FMT_FLT, it > should > > only be some desinterleaving. Which is really easy to do. > > > > The points I don't get are: > > > > 1. How can you send a float buffer on a char buffer ? Do we treat them > > as-is (float* floatSamples = (float*) samples) ? If so, what means the > > sample number avcodec gives you ? Is it the number of floats or chars > ? > > The sample number is the number of floats per channel. So if you have a > stereo non-interleaved (aka planar) float stream with 32 bytes per > channel (aka plane in this case), ffmpeg will think of it as 8 samples. > > > 2. How can you send datas on two buffers (one for left, one for right) > > when avcodec_fill_audio_frame only takes a (uint8_t*) parameter and > not a > > (uint8_t**) for multiple channels ? Does-it completely change the > previous > > sample code ? > > I think avcodec_fill_audio_frame() should be considered legacy. The > best way is to create an AVFrame with: > > frame = av_frame_alloc(); > frame.format = ...; > ... set other parameters ... > av_frame_get_buffer(frame, 32); // allocates frame data, using the params > > And then you copy in your source data. > > > I tried to find some answers myself and I made a LOT of experiments so > far > > but I failed on theses points. Since there is a huge lack of > documentation > > on these, I would be very grateful if you had answers. > > > > Thank you ! > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From 864446364 at qq.com Mon Aug 4 04:54:33 2014 From: 864446364 at qq.com (=?gb2312?B?zuLWvsCk?=) Date: Mon, 4 Aug 2014 10:54:33 +0800 Subject: [Libav-user] about "Missing reference picture, default is 0"and" decode_slice_header_error" Message-ID: <000001cfaf8f$6bb48310$431d8930$@qq.com> Hello. I am using a program with FFmpeg?s libav to demux a mp4 file, try to extract the video, whose format is 264 . The file is transmitted in streaming media, using http protocol . Program start receiving data at any time, I mean not from the head. Then it complains that "Missing reference picture,default is 0" and " decode_slice_header_error", as showed in the following picture This error generates from the functions named ?avformat_open_input? and ?avformat_find_stream_info ? in FFmpeg libav. I try to print out the frame data my program received, and I found that the program can?t get IDR frame. (the begin of the frames always be 0 0 0 1 65, it means the frame is not IDR frame) So it complains no reference frame. In fact, I have checked that the IDR frame is nearly 1/55 of all the frames. I think the proportion is OK. So I am looking for your help about this problem. I am looking forward to hearing from you soon. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 49718 bytes Desc: not available URL: From prashanth.bhat at yahoo.com Sat Aug 2 13:18:08 2014 From: prashanth.bhat at yahoo.com (P Bhat) Date: Sat, 2 Aug 2014 11:18:08 +0000 (UTC) Subject: [Libav-user] Hardware Accelerated Decoding References: <529882E8.6010008@gmail.com> <20131130190526.08afc86b@debian> <529B3373.7080000@gmail.com> Message-ID: Safi ud Din Khan writes: > > Hey thank you for the help i have finally successfully implemented > hardware acceleration inside my program all thanks to you > > I'm in the same situation. Could you please share your experience on how you successfully implemented the VAAPI hardware acceleration for H.264 decoding? Thanks. From ierumshanaya85 at gmail.com Mon Aug 4 20:36:20 2014 From: ierumshanaya85 at gmail.com (Ierum Shanaya) Date: Tue, 5 Aug 2014 00:06:20 +0530 Subject: [Libav-user] Multithreading - not able to create threads - ffmpeg Message-ID: Hi All, My aim is to decode video on sniper simulator using ffmpeg. For this I am using the demuxing_decoding.c with few changes , like addition of thread_count in function main, /*sample snippet*/ in function main() { ........... if (open_codec_context (&video_stream_idx , fmt_ctx, AVMEDIA_TYPE_VIDEO ) >= 0) { 256 video_stream = fmt_ctx->streams [video_stream_idx ]; 257 video_dec_ctx = video_stream->codec ; */*NEW ADDITION TO CREATE THREADS - set the thread count*/* *video_dec_ctc->thread_count = 3;* ............. } This is to create 4 threads for decoding video. I am compiling the program using the command gcc -o demuxDecode demuxing_decoding.c -lavutil -lavformat -lavcodec -lz -lavutil -lm -lpthread Now comes the actual problem: The threads are not getting created.. I am not able to understand the problem, since on other machine ( 64 bit laptop's) its happening and not on mine. I have a 64 bit Ubuntu 12.04 installed on my system. The sniper simulator is simulating 4 cores, but since ffmpeg is not creating the threads, the 4 cores are not getting used. Only 1 thread is getting created. I have the gcc version 4,6,3 installed, ---------------------------------------------------------------------------------------------------------------- ierumshanaya at ubuntu:/usr/local/lib$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ---------------------------------------------------------------------------------------------------------------- *I have checked for the libpthread.a and libpthread.so library files also, and they are present in the path* --------------------------------------------------------------------------------------------------------------- ierumshanaya at ubuntu:/usr/local/lib$ locate libpthread /home/ierumshanaya/.local/share/Trash/files/pin-2.13-65163-gcc.4.4.7-linux/source/tools/Probes/tpss_lin_libpthread.cpp /home/ierumshanaya/sescutils/build-mipseb-linux/obj/glibc-build/linuxthreads/libpthread.a /home/ierumshanaya/sescutils/install/mipseb-linux/lib/libpthread.a /home/ierumshanaya/sniper-5.3/pin_kit/pin-2.13-61206-gcc.4.4.7-linux/source/tools/Probes/tpss_lin_libpthread.cpp /home/ierumshanaya/sniper-5.3/pin_kit/source/tools/Probes/tpss_lin_libpthread.cpp /lib/x86_64-linux-gnu/libpthread-2.15.so /lib/x86_64-linux-gnu/libpthread.so.0 /lib32/libpthread-2.15.so /lib32/libpthread.so.0 /usr/lib/x86_64-linux-gnu/libpthread.a /usr/lib/x86_64-linux-gnu/libpthread.so /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib32/libpthread.a /usr/lib32/libpthread.so /usr/lib32/libpthread_nonshared.a /usr/share/doc/libpthread-stubs0 /usr/share/doc/libpthread-stubs0-dev /usr/share/doc/libpthread-stubs0/changelog.Debian.gz /usr/share/doc/libpthread-stubs0/copyright /usr/share/doc/libpthread-stubs0-dev/README /usr/share/doc/libpthread-stubs0-dev/changelog.Debian.gz /usr/share/doc/libpthread-stubs0-dev/copyright /var/lib/dpkg/info/libpthread-stubs0-dev:amd64.list /var/lib/dpkg/info/libpthread-stubs0-dev:amd64.md5sums /var/lib/dpkg/info/libpthread-stubs0:amd64.list /var/lib/dpkg/info/libpthread-stubs0:amd64.md5sums ----------------------------------------------------------------------------------------------------------------------- *My question now is -* 1) Is gcc not able to link the pthread library and hence not able to create threads?? 2) Or, is gcc linking it from the lib32 directory and not usr/local/lib and since it is a 64bit machine, this is happening. Then how to solve this issue??? 3) Since the code is able to create threads on some systems of my friends, it is for sure that adding thread_count is working. So, where is the problem. Can someone please give me some pointers. Thanks, Ierum -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Tue Aug 5 04:36:58 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Tue, 5 Aug 2014 06:36:58 +0400 Subject: [Libav-user] Video frames pts/dts Message-ID: Hello. I stream video over udp and can't calculate pts/dts. outputStream_->sample_aspect_ratio.den = inputCodecContext_->sample_aspect_ratio.den; outputStream_->sample_aspect_ratio.num = inputCodecContext_->sample_aspect_ratio.num; outputStream_->time_base.num = 1; outputStream_->time_base.den = frame_rate_ * inputCodecContext_->ticks_per_frame; outputStream_->time_base.num = 1; outputStream_->time_base.den = 1000; outputStream_->r_frame_rate.num = frame_rate_; outputStream_->r_frame_rate.den = 1; outputStream_->avg_frame_rate.den = 1; outputStream_->avg_frame_rate.num = frame_rate_; outputStream_->codec->bit_rate = inputCodecContext_->bit_rate; //outputStream_->duration = (m_out_end_time - m_out_start_time) * 1000; outputStream_->duration = inputFormatContext_->duration; outputFormatContext_->bit_rate = inputFormatContext_->bit_rate; ret = avcodec_open2(outputStream_->codec, encoder_, NULL); if (unlikely(ret < 0)) setErrorFromAvError(ret); ret = avio_open(&outputFormatContext_->pb, url, AVIO_FLAG_WRITE); if (unlikely(ret < 0)) setErrorFromAvError(ret); is_open_ = true; SwsContext* img_convert_context = sws_getCachedContext(NULL, inputCodecContext_->width, inputCodecContext_->height, inputCodecContext_->pix_fmt, outputStream_->codec->width, outputStream_->codec->height, AV_PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL); if (img_convert_context != NULL) swsContext_= boost::shared_ptr (img_convert_context, sws_freeContext); if (likely(is_open_)) { AVFrame* frame = av_frame_alloc(); AVPacket packet, outputPacket; outputPacket.size = 0; outputPacket.data = NULL; AVPicture pict; avpicture_alloc(&pict, AV_PIX_FMT_YUV420P, inputCodecContext_->width, inputCodecContext_->height); //int vid_pts = 0; while (av_read_frame(inputFormatContext_, &packet) >= 0) { outputStream_->pts = {0, 1, 1000}; if (packet.stream_index == 1) { int frame_finished; std::cout << "packet.dts " << packet.dts << " packet.pts " << packet.pts << std::endl; /*packet.dts = av_rescale_q_rnd(packet.dts, inputFormatContext_->streams[inputVideoStreamIndex_]->time_base, inputFormatContext_->streams[inputVideoStreamIndex_]->codec->time_base, static_cast (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX)); packet.pts = av_rescale_q_rnd(packet.pts, inputFormatContext_->streams[inputVideoStreamIndex_]->time_base, inputFormatContext_->streams[inputVideoStreamIndex_]->codec->time_base, static_cast (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));*/ avcodec_decode_video2(inputCodecContext_.get(), frame, &frame_finished, &packet); if (frame_finished) { sws_scale(swsContext_.get(), frame->data, frame->linesize, 0, inputCodecContext_->height, pict.data, pict.linesize); int got_packet = 0; int stream_index = 0; outputPacket.stream_index = stream_index; frame->pict_type = AV_PICTURE_TYPE_NONE; av_init_packet(&outputPacket); outputPacket.stream_index = 0; outputPacket.flags = AV_PKT_FLAG_KEY; outputPacket.duration = packet.duration; avcodec_encode_video2(outputStream_->codec, &outputPacket, frame, &got_packet); std::cout << "packet.dts " << packet.dts << " packet.pts " << packet.pts << std::endl; outputPacket.dts = av_rescale_q_rnd(outputPacket.dts, inputFormatContext_->streams[inputVideoStreamIndex_]->time_base, inputFormatContext_->streams[inputVideoStreamIndex_]->codec->time_base, static_cast (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX)); outputPacket.pts = av_rescale_q_rnd(outputPacket.pts, inputFormatContext_->streams[inputVideoStreamIndex_]->time_base, inputFormatContext_->streams[inputVideoStreamIndex_]->codec->time_base, static_cast (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX)); outputPacket.duration = packet.duration; //outputPacket.pts = vid_pts ++; if (got_packet) { outputPacket.stream_index = 0; av_interleaved_write_frame(outputFormatContext_.get(), &outputPacket); } av_free_packet(&outputPacket); outputPacket.size = 0; outputPacket.data = NULL; } } } avpicture_free(&pict); av_free_packet(&packet); // Free the YUV frame av_free(frame); } vlc shows video frames with losts order, ffplay shows file but not all -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Tue Aug 5 04:37:16 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Tue, 5 Aug 2014 06:37:16 +0400 Subject: [Libav-user] Video frames pts/dts In-Reply-To: References: Message-ID: So what I do wrong? 2014-08-05 6:36 GMT+04:00 Dmitry Adjiev : > Hello. > I stream video over udp and can't calculate pts/dts. > > > outputStream_->sample_aspect_ratio.den = > inputCodecContext_->sample_aspect_ratio.den; > outputStream_->sample_aspect_ratio.num = > inputCodecContext_->sample_aspect_ratio.num; > outputStream_->time_base.num = 1; > outputStream_->time_base.den = frame_rate_ * > inputCodecContext_->ticks_per_frame; > outputStream_->time_base.num = 1; > outputStream_->time_base.den = 1000; > outputStream_->r_frame_rate.num = frame_rate_; > outputStream_->r_frame_rate.den = 1; > outputStream_->avg_frame_rate.den = 1; > outputStream_->avg_frame_rate.num = frame_rate_; > outputStream_->codec->bit_rate = inputCodecContext_->bit_rate; > //outputStream_->duration = (m_out_end_time - m_out_start_time) * 1000; > outputStream_->duration = inputFormatContext_->duration; > outputFormatContext_->bit_rate = inputFormatContext_->bit_rate; > > ret = avcodec_open2(outputStream_->codec, encoder_, NULL); > > if (unlikely(ret < 0)) > setErrorFromAvError(ret); > > > ret = avio_open(&outputFormatContext_->pb, url, AVIO_FLAG_WRITE); > > if (unlikely(ret < 0)) > setErrorFromAvError(ret); > > is_open_ = true; > > SwsContext* img_convert_context = > sws_getCachedContext(NULL, inputCodecContext_->width, > inputCodecContext_->height, > inputCodecContext_->pix_fmt, > outputStream_->codec->width, > outputStream_->codec->height, > AV_PIX_FMT_YUV420P, > SWS_FAST_BILINEAR, NULL, NULL, NULL); > > if (img_convert_context != NULL) > swsContext_= boost::shared_ptr (img_convert_context, > sws_freeContext); > > if (likely(is_open_)) { > > AVFrame* frame = av_frame_alloc(); > AVPacket packet, outputPacket; > outputPacket.size = 0; > outputPacket.data = NULL; > AVPicture pict; > avpicture_alloc(&pict, AV_PIX_FMT_YUV420P, > inputCodecContext_->width, inputCodecContext_->height); > //int vid_pts = 0; > > while (av_read_frame(inputFormatContext_, &packet) >= 0) { > outputStream_->pts = {0, 1, 1000}; > > if (packet.stream_index == 1) { > int frame_finished; > std::cout << "packet.dts " << packet.dts << " packet.pts " > << packet.pts << std::endl; > /*packet.dts = av_rescale_q_rnd(packet.dts, > > inputFormatContext_->streams[inputVideoStreamIndex_]->time_base, > > inputFormatContext_->streams[inputVideoStreamIndex_]->codec->time_base, > static_cast > (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX)); > packet.pts = av_rescale_q_rnd(packet.pts, > > inputFormatContext_->streams[inputVideoStreamIndex_]->time_base, > > inputFormatContext_->streams[inputVideoStreamIndex_]->codec->time_base, > static_cast > (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));*/ > avcodec_decode_video2(inputCodecContext_.get(), frame, > &frame_finished, &packet); > > if (frame_finished) { > sws_scale(swsContext_.get(), frame->data, > frame->linesize, 0, inputCodecContext_->height, pict.data, pict.linesize); > int got_packet = 0; > int stream_index = 0; > outputPacket.stream_index = stream_index; > frame->pict_type = AV_PICTURE_TYPE_NONE; > av_init_packet(&outputPacket); > outputPacket.stream_index = 0; > outputPacket.flags = AV_PKT_FLAG_KEY; > outputPacket.duration = packet.duration; > > avcodec_encode_video2(outputStream_->codec, > &outputPacket, frame, &got_packet); > > std::cout << "packet.dts " << packet.dts << " > packet.pts " << packet.pts << std::endl; > outputPacket.dts = av_rescale_q_rnd(outputPacket.dts, > > inputFormatContext_->streams[inputVideoStreamIndex_]->time_base, > > inputFormatContext_->streams[inputVideoStreamIndex_]->codec->time_base, > static_cast > (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX)); > outputPacket.pts = av_rescale_q_rnd(outputPacket.pts, > > inputFormatContext_->streams[inputVideoStreamIndex_]->time_base, > > inputFormatContext_->streams[inputVideoStreamIndex_]->codec->time_base, > static_cast > (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX)); > outputPacket.duration = packet.duration; > //outputPacket.pts = vid_pts ++; > > if (got_packet) { > outputPacket.stream_index = 0; > > av_interleaved_write_frame(outputFormatContext_.get(), &outputPacket); > } > > av_free_packet(&outputPacket); > outputPacket.size = 0; > outputPacket.data = NULL; > } > } > } > > avpicture_free(&pict); > > av_free_packet(&packet); > // Free the YUV frame > av_free(frame); > } > > vlc shows video frames with losts order, ffplay shows file but not all > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsy at etri.re.kr Tue Aug 5 14:53:36 2014 From: jsy at etri.re.kr (=?ks_c_5601-1987?B?waS8vMCx?=) Date: Tue, 5 Aug 2014 12:53:36 +0000 Subject: [Libav-user] How to make output frame with 2 times width and height than those of input frame and How to access the data? Message-ID: <0EED5AB600F4264CB334AAF9C5B3A39A292874F0@SMTP2.etri.info> Dear Experts, I am developing a Super-resolution filter for ffmpeg. I would like to access the output frame by pointer. I tried to access the data of outframe, so I write simple code as below. The below is the main parts of my code. 1. config_output function (? I would like to know other things required to make outlink with frame Size of 2xWidth and 2xHeigth of input frame ? ) First, I added config_output function in myfiter.c config_output(AVFilterLinek *outlink) { int config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; AVFilterLink *inlink = outlink->src->inputs[0]; SR1Context *s = (SR1Context *)outlink->src->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get((AVPixelFormat)inlink->format); int64_t w, h; w = inlink->w; h = inlink->h; w = w << 1; h = h << 1; if (w < 0 || h < 0){ av_log(ctx, AV_LOG_ERROR, "Size values less thank 0 are not acceptalbe. \n"); return AVERROR(EINVAL); } outlink->w = w; outlink->h = h; outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; return 0; } 2. filter_frame : Then, I access the data of outframe by pointer in fiter_frame as below (Is this right method to access the data of outframe? If it is not right method, please let me know that. ) int filter_frame(AVFilterLink *inlink, AVFrame *frame) { SR1Context *s = (SR1Context *)inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; AVFrame *out; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get((AVPixelFormat)inlink->format); out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out){ av_frame_free(&frame); return AVERROR(ENOMEM); } av_frame_copy_props(out, frame); int plane, x, y, xb = s->x, yb = s->y; unsigned char *row_in[4]; // Y,U,V,A unsigned char *row_out[4]; // Y.U,V,A int full_height = frame->height; int full_width = frame->linesize[0]; int twice_width = full_width << 1; for (y = 0; y < frame->height; y++) { row_in[0] = frame->data[0] + y * full_width; row_out[0] = out->data[0] + y *twice_width; memcpy(row_out, row_in, full_width); memcpy(row_out + full_width, row_in, full_width); memcpy(row_out + twice_width*(full_height), row_in, full_width); memcpy(row_out + twice_width*(full_height)+full_width, row_in, full_width); } return ff_filter_frame(outlink, out); } Best Regards, Seyoon -------------- next part -------------- An HTML attachment was scrubbed... URL: From u at pkh.me Tue Aug 5 15:02:19 2014 From: u at pkh.me (=?utf-8?B?Q2zDqW1lbnQgQsWTc2No?=) Date: Tue, 5 Aug 2014 15:02:19 +0200 Subject: [Libav-user] How to make output frame with 2 times width and height than those of input frame and How to access the data? In-Reply-To: <0EED5AB600F4264CB334AAF9C5B3A39A292874F0@SMTP2.etri.info> References: <0EED5AB600F4264CB334AAF9C5B3A39A292874F0@SMTP2.etri.info> Message-ID: <20140805130219.GZ10372@leki> On Tue, Aug 05, 2014 at 12:53:36PM +0000, ?????? wrote: > Dear Experts, > > I am developing a Super-resolution filter for ffmpeg. > > I would like to access the output frame by pointer. > Look at filters such as hqx (for n=2 in your case I suppose). Also see doc/writing_filters.txt in the repository. Last, you should discuss this on ffmpeg-devel, assuming you plan to submit it to the project. Best regards, [...] -- Cl?ment B. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 473 bytes Desc: not available URL: From michaelni at gmx.at Fri Aug 8 03:32:04 2014 From: michaelni at gmx.at (Michael Niedermayer) Date: Fri, 8 Aug 2014 03:32:04 +0200 Subject: [Libav-user] [FFmpeg-devel] FFmpeg and OPW In-Reply-To: <20140801011631.GJ4649@nb4> References: <20140801011631.GJ4649@nb4> Message-ID: <20140808013204.GC12391@nb4> Hi all On Fri, Aug 01, 2014 at 03:16:31AM +0200, Michael Niedermayer wrote: > Hi all > > OPW (Outreach Program for Women) is twice per year (compared to google > summer of code which is just once a year) > > FFmpeg can participate in the next round but we need to fund at least > 1 intern/student (6250 USD) for that. OPW is not run by a large > corporation with deep pockets. > > Thus my mail here, if you are/represent a company or know one who does > and who uses and benefits from FFmpeg, and has the financial resources, > please consider to donate or ask/forward this mail. > > Why should you donate? > Well the money will be used to fund a intern working on and improving > FFmpeg. (assuming there will be a intern who wants to work on FFmpeg > in OPW) 1 week passed, 3 weeks left Companies and individuals sofar have donated 105 USD to our ffmpeg-opw account. Thanks to the donators for their support of the FFmpeg free software community! Note, we do need at a minimum 6250 USD Thanks! [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: From michael.ivanov at idomoo.com Sun Aug 10 12:45:07 2014 From: michael.ivanov at idomoo.com (Michael Ivanov) Date: Sun, 10 Aug 2014 13:45:07 +0300 Subject: [Libav-user] How to decode arbitrary frame In-Reply-To: <1374151353.85762.YahooMailNeo@web163902.mail.gq1.yahoo.com> References: <1374151353.85762.YahooMailNeo@web163902.mail.gq1.yahoo.com> Message-ID: Hi All.I found a memory leak when decoding a video on Windows.During decoding I release both the packet and the frame but the memory keeps growing. On Thu, Jul 18, 2013 at 3:42 PM, James Board wrote: > I have the doc/examples programs compiled and running. I use > the program demuxing.c to decode an AVI file. From the source > code, it looks it calls its own subroutine decode_packet() to decode > the next video or audio packet, and that subroutine calls > avcodec_ecode_video2()to decode the next frame. But they all decode > sequential frames. How can I decode an arbitrary frame in the > video stream? > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- Michael Ivanov Pixel Killer at Idomoo Ltd. michael.ivanov at idomoo.com +972 54 496 2254(mobile) -- *This email and any files transmitted with it contain information from Idomoo which may be privileged and confidential and intended solely for the use of the addressee. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited; please notify us immediately by* *an **email reply and delete it from your system. Idomoo accepts no liability for any personal views or opinions expressed in this email. Email transmission cannot be guaranteed to be secure or error-free. Idomoo therefore is not liable for any errors or omissions in the contents of this message, which arise as a result of email transmission.* -------------- next part -------------- An HTML attachment was scrubbed... URL: From sam.verschueren at gmail.com Mon Aug 11 20:16:40 2014 From: sam.verschueren at gmail.com (Sam Verschueren) Date: Mon, 11 Aug 2014 20:16:40 +0200 Subject: [Libav-user] Video audio to MP3 Message-ID: Hi I want to transcode the audio of a video to an MP3 file. Can anyone point me in the right direction? I succeeded in finding the AVMEDIA_TYPE_AUDIO stream in the video file. But I don't know how I should continue... Do I have to use something like swr_convert()? I am really a noob in ffmpeg with C/C++ so any help would be welcome. Thanks in advance! Sam -------------- next part -------------- An HTML attachment was scrubbed... URL: From d3ck0r at gmail.com Tue Aug 12 00:42:49 2014 From: d3ck0r at gmail.com (J Decker) Date: Mon, 11 Aug 2014 15:42:49 -0700 Subject: [Libav-user] Seek to 0 doesn't reset dts/pts Message-ID: I suspend processing, clear all my buffer queues and start reading the file again. But the first video frame has the timestamp of the last frame to show. How do I make sure the pVideoFrame pkt_pts and pkt_dts go back to 0? I found these file->pVideoCodecCtx->pts_correction_last_dts = 0; file->pVideoCodecCtx->pts_correction_last_pts = 0; and set them to 0 also when I seek; but the timstamp is still being set wrong. I'm on windows, using latest x86 dll build from http://ffmpeg.zeranoe.com/ so I don't have symbols.... and other than setting a breakpoint on the videoframe pkt_dts change, I don't know really what the data is coming from. -------------- next part -------------- An HTML attachment was scrubbed... URL: From d3ck0r at gmail.com Tue Aug 12 03:15:12 2014 From: d3ck0r at gmail.com (J Decker) Date: Mon, 11 Aug 2014 18:15:12 -0700 Subject: [Libav-user] Seek to 0 doesn't reset dts/pts In-Reply-To: References: Message-ID: wasn't properly flushing the video coded... feeding a NULL data packet until !packet_completed On Mon, Aug 11, 2014 at 3:42 PM, J Decker wrote: > I suspend processing, clear all my buffer queues and start reading the > file again. But the first video frame has the timestamp of the last frame > to show. How do I make sure the pVideoFrame pkt_pts and pkt_dts go back to > 0? > > I found these > file->pVideoCodecCtx->pts_correction_last_dts = 0; > file->pVideoCodecCtx->pts_correction_last_pts = 0; > > and set them to 0 also when I seek; but the timstamp is still being set > wrong. > I'm on windows, using latest x86 dll build from http://ffmpeg.zeranoe.com/ > so I don't have symbols.... and other than setting a breakpoint on the > videoframe pkt_dts change, I don't know really what the data is coming from. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From suprith1230 at gmail.com Tue Aug 12 14:42:17 2014 From: suprith1230 at gmail.com (Suprith Gowda) Date: Tue, 12 Aug 2014 18:12:17 +0530 Subject: [Libav-user] undefined reference to sws_getcontext Message-ID: Hi , i am building an application using ffmpeg.. but end up in error 1. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined reference to sws_getcontext. 2. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined reference to sws_scale. At this point I'm falling out of any ideas at all, why exactly compilation fails? Thanks suprith -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.leppkes at gmail.com Tue Aug 12 14:46:25 2014 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Tue, 12 Aug 2014 14:46:25 +0200 Subject: [Libav-user] undefined reference to sws_getcontext In-Reply-To: References: Message-ID: On Tue, Aug 12, 2014 at 2:42 PM, Suprith Gowda wrote: > Hi , > i am building an application using ffmpeg.. but end up in error > > 1. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined > reference to sws_getcontext. > 2. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined > reference to sws_scale. > > At this point I'm falling out of any ideas at all, why exactly compilation > fails? > > libffmpeg.so is not something ffmpeg natively generates, so whatever you used to generate this just doesn't include those functions in it. - Hendrik From adjiev.dmitry at gmail.com Tue Aug 12 15:02:52 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Tue, 12 Aug 2014 17:02:52 +0400 Subject: [Libav-user] undefined reference to sws_getcontext In-Reply-To: References: Message-ID: Please let me know if I understood something wrokt, but if this is libs issue, try to use the fllowing command line for compilation: -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil -lbz2 -lm -lz -lpthread -lpostproc Libs should be exatrly in this order 2014-08-12 16:46 GMT+04:00 Hendrik Leppkes : > On Tue, Aug 12, 2014 at 2:42 PM, Suprith Gowda > wrote: > > Hi , > > i am building an application using ffmpeg.. but end up in error > > > > 1. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined > > reference to sws_getcontext. > > 2. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined > > reference to sws_scale. > > > > At this point I'm falling out of any ideas at all, why exactly > compilation > > fails? > > > > > > libffmpeg.so is not something ffmpeg natively generates, so whatever > you used to generate this just doesn't include those functions in it. > > - Hendrik > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From suprith1230 at gmail.com Tue Aug 12 15:40:53 2014 From: suprith1230 at gmail.com (Suprith Gowda) Date: Tue, 12 Aug 2014 19:10:53 +0530 Subject: [Libav-user] undefined reference to sws_getcontext In-Reply-To: References: Message-ID: thanks it worked , i misplaced the order of Libs Thanks suprith On Tue, Aug 12, 2014 at 6:32 PM, Dmitry Adjiev wrote: > Please let me know if I understood something wrokt, but if this is libs > issue, try to use the fllowing command line for compilation: > -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil > -lbz2 -lm -lz -lpthread -lpostproc > Libs should be exatrly in this order > > > > 2014-08-12 16:46 GMT+04:00 Hendrik Leppkes : > > On Tue, Aug 12, 2014 at 2:42 PM, Suprith Gowda >> wrote: >> > Hi , >> > i am building an application using ffmpeg.. but end up in error >> > >> > 1. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined >> > reference to sws_getcontext. >> > 2. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined >> > reference to sws_scale. >> > >> > At this point I'm falling out of any ideas at all, why exactly >> compilation >> > fails? >> > >> > >> >> libffmpeg.so is not something ffmpeg natively generates, so whatever >> you used to generate this just doesn't include those functions in it. >> >> - Hendrik >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > > -- > Regards, > Dmitry > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Tue Aug 12 16:08:09 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Tue, 12 Aug 2014 18:08:09 +0400 Subject: [Libav-user] udp: Video multicasring Message-ID: Hello. I work for video streamer for android. For now I just read file and send it in network. if (stream.stream->codec->coded_frame->key_frame) p.flags |= AV_PKT_FLAG_KEY; if (got_packet_ptr) { p.dts = av_rescale_q_rnd(p.dts, stream.output_format_context->streams[0]->codec->time_base, stream.output_format_context->streams[0]->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); p.pts = av_rescale_q_rnd(p.pts, stream.output_format_context->streams[0]->codec->time_base, stream.output_format_context->streams[0]->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); p.duration = av_rescale_q(p.duration, stream.output_format_context->streams[0]->codec->time_base, stream.output_format_context->streams[0]->time_base); av_interleaved_write_frame(stream.output_format_context, &p); av_frame_free(&frame); av_free_packet(&p); } } But this occupies the entire channel it works, but it occupies the entire network channel. What can I do with sending for decrease network lodaing.. What I do wrong? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Tue Aug 12 16:31:47 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Tue, 12 Aug 2014 18:31:47 +0400 Subject: [Libav-user] undefined reference to sws_getcontext In-Reply-To: References: Message-ID: You are welcome. Can you help me with udp streaming? Thread is "udp: video multicasting" 2014-08-12 17:40 GMT+04:00 Suprith Gowda : > thanks it worked , > i misplaced the order of Libs > > > Thanks > suprith > > > On Tue, Aug 12, 2014 at 6:32 PM, Dmitry Adjiev > wrote: > >> Please let me know if I understood something wrokt, but if this is libs >> issue, try to use the fllowing command line for compilation: >> -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale >> -lavutil -lbz2 -lm -lz -lpthread -lpostproc >> Libs should be exatrly in this order >> >> >> >> 2014-08-12 16:46 GMT+04:00 Hendrik Leppkes : >> >> On Tue, Aug 12, 2014 at 2:42 PM, Suprith Gowda >>> wrote: >>> > Hi , >>> > i am building an application using ffmpeg.. but end up in error >>> > >>> > 1. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined >>> > reference to sws_getcontext. >>> > 2. /usr/local/gcc/x86_linux-gnu/4.7/../../lib/libmpeg.so: undefined >>> > reference to sws_scale. >>> > >>> > At this point I'm falling out of any ideas at all, why exactly >>> compilation >>> > fails? >>> > >>> > >>> >>> libffmpeg.so is not something ffmpeg natively generates, so whatever >>> you used to generate this just doesn't include those functions in it. >>> >>> - Hendrik >>> _______________________________________________ >>> Libav-user mailing list >>> Libav-user at ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/libav-user >>> >> >> >> >> -- >> Regards, >> Dmitry >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> >> > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From yxf0605 at gmail.com Wed Aug 13 05:06:32 2014 From: yxf0605 at gmail.com (Xiaofei Yang) Date: Wed, 13 Aug 2014 11:06:32 +0800 Subject: [Libav-user] SwrContext compile error Message-ID: Hi, guys: I'm using SwrContext in my project, when I compile it using gcc, it complains dereferencing pointer to incomplete type av_rescale_rnd(src_nb_samples, *swr_ctx->out_sample_rate*, swr_ctx->in_sample_rate, AV_ROUND_UP); I have include "libswresample/swresample.h" Does anyone know how to fix it? Many thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Wed Aug 13 13:00:17 2014 From: nfxjfg at googlemail.com (wm4) Date: Wed, 13 Aug 2014 13:00:17 +0200 Subject: [Libav-user] SwrContext compile error In-Reply-To: References: Message-ID: <20140813130017.66fbb994@debian> On Wed, 13 Aug 2014 11:06:32 +0800 Xiaofei Yang wrote: > Hi, guys: > > I'm using SwrContext in my project, when I compile it using gcc, it > complains > > > dereferencing pointer to incomplete type > > av_rescale_rnd(src_nb_samples, *swr_ctx->out_sample_rate*, > swr_ctx->in_sample_rate, AV_ROUND_UP); > > I have include "libswresample/swresample.h" > > Does anyone know how to fix it? > > Many thanks The contents of SwrContext are private to libswsresample (and AFAIK always were). Rewrite your code, it's not a huge change to fix it. From yxf0605 at gmail.com Wed Aug 13 13:46:46 2014 From: yxf0605 at gmail.com (Xiaofei Yang) Date: Wed, 13 Aug 2014 19:46:46 +0800 Subject: [Libav-user] SwrContext compile error In-Reply-To: <20140813130017.66fbb994@debian> References: <20140813130017.66fbb994@debian> Message-ID: Got it. Thanks 2014-08-13 19:00 GMT+08:00 wm4 : > On Wed, 13 Aug 2014 11:06:32 +0800 > Xiaofei Yang wrote: > > > Hi, guys: > > > > I'm using SwrContext in my project, when I compile it using gcc, it > > complains > > > > > > dereferencing pointer to incomplete type > > > > av_rescale_rnd(src_nb_samples, *swr_ctx->out_sample_rate*, > > swr_ctx->in_sample_rate, AV_ROUND_UP); > > > > I have include "libswresample/swresample.h" > > > > Does anyone know how to fix it? > > > > Many thanks > > The contents of SwrContext are private to libswsresample (and AFAIK > always were). Rewrite your code, it's not a huge change to fix it. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jyavenard at gmail.com Wed Aug 13 14:50:07 2014 From: jyavenard at gmail.com (Jean-Yves Avenard) Date: Wed, 13 Aug 2014 22:50:07 +1000 Subject: [Libav-user] Finding best corresponding between channel number and channel layout Message-ID: Hi Seeing the AVCodecContext::request_channels is now deprecated ; what would be the best way to replace its use with request_channel_layout e.g. something that gives the most likely layout for a given number of channels ? for mono and stereo, it's obvious... for more than 2 channels it starts to get murky.. Thanks JY From jyavenard at gmail.com Wed Aug 13 14:55:14 2014 From: jyavenard at gmail.com (Jean-Yves Avenard) Date: Wed, 13 Aug 2014 22:55:14 +1000 Subject: [Libav-user] Finding best corresponding between channel number and channel layout In-Reply-To: References: Message-ID: On 13 August 2014 22:50, Jean-Yves Avenard wrote: > Hi > > Seeing the AVCodecContext::request_channels is now deprecated ; what > would be the best way to replace its use with request_channel_layout > > e.g. something that gives the most likely layout for a given number of > channels ? > > for mono and stereo, it's obvious... for more than 2 channels it > starts to get murky.. never mind... just found av_get_default_channel_layout From zachary.sears at lmco.com Wed Aug 13 17:53:33 2014 From: zachary.sears at lmco.com (Sears, Zachary) Date: Wed, 13 Aug 2014 15:53:33 +0000 Subject: [Libav-user] AV_CODEC_ID_SMPTE_KLV not recognized Message-ID: <4F5821D221CBBD458171BA6BA7C5546A1022B85E@HDXDSP33.us.lmco.com> Hello, I am trying to create an application that can add a KLV data stream into an MPEG-TS stream. I started with the muxing.C example and have everything working as far as creating a valid MPEG-TS video, but when I try and include the KLV stream the encoder can't be found. In particular it is failing when I try AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_SMPTE_KLV), it returns with a failure to open the encoder. When I add the video stream the codec id is AV_CODEC_ID_MPEG2VIDEO which it finds perfectly fine and everything works just fine. I am using ffmpeg 2.1.4. I also have a known good sample video that has KLV metadata in it and when I try to use ffprobe on that video it finds both streams but returns with "Unsupported codec with id 1263294017 for input stream 1" where input stream 1 is the KLV stream. Could it just be that I missed a flag at compile time, or simply need a newer version of FFMPEG? Thanks for any help -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Wed Aug 13 18:07:59 2014 From: nfxjfg at googlemail.com (wm4) Date: Wed, 13 Aug 2014 18:07:59 +0200 Subject: [Libav-user] AV_CODEC_ID_SMPTE_KLV not recognized In-Reply-To: <4F5821D221CBBD458171BA6BA7C5546A1022B85E@HDXDSP33.us.lmco.com> References: <4F5821D221CBBD458171BA6BA7C5546A1022B85E@HDXDSP33.us.lmco.com> Message-ID: <20140813180759.58a3b345@debian> On Wed, 13 Aug 2014 15:53:33 +0000 "Sears, Zachary" wrote: > Hello, > > I am trying to create an application that can add a KLV data stream into an MPEG-TS stream. I started with the muxing.C example and have everything working as far as creating a valid MPEG-TS video, but when I try and include the KLV stream the encoder can't be found. In particular it is failing when I try AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_SMPTE_KLV), it returns with a failure to open the encoder. When I add the video stream the codec id is AV_CODEC_ID_MPEG2VIDEO which it finds perfectly fine and everything works just fine. I am using ffmpeg 2.1.4. > > I also have a known good sample video that has KLV metadata in it and when I try to use ffprobe on that video it finds both streams but returns with "Unsupported codec with id 1263294017 for input stream 1" where input stream 1 is the KLV stream. Could it just be that I missed a flag at compile time, or simply need a newer version of FFMPEG? > > Thanks for any help I have no idea what KLV is, but looking at the source, it seems KLV is supported for demuxing and muxing (in libavformat), but there are no encoders or decoders. I assume this means you have to interpret/generate KLV data yourself. From zachary.sears at lmco.com Wed Aug 13 19:43:30 2014 From: zachary.sears at lmco.com (Sears, Zachary) Date: Wed, 13 Aug 2014 17:43:30 +0000 Subject: [Libav-user] EXTERNAL: Re: AV_CODEC_ID_SMPTE_KLV not recognized In-Reply-To: <20140813180759.58a3b345@debian> References: <4F5821D221CBBD458171BA6BA7C5546A1022B85E@HDXDSP33.us.lmco.com> <20140813180759.58a3b345@debian> Message-ID: <4F5821D221CBBD458171BA6BA7C5546A1022B8C8@HDXDSP33.us.lmco.com> Thanks for the quick reply, I started down that path and do have code that generates valid TS packets with KLV data, from what you're saying it sounds like that was the right path to take. I guess the problem that I keep getting hung up on after that is how to create the additional stream to have a type of AVMEDIA_TYPE_VIDEO and at least an id of AV_CODEC_ID_SMPTE_KLV, from the output of ffprobe it certainly seems like this is recognized by ffmpeg but I can't figure out how to do it. For the video stream at least I do avformat_new_stream(avFormatContext, avCodec), but since there is no codec for the KLV data (NULL is returned from avcodec_find_encoder), I guess I am a little confused on how to get to that point. The end that I need to find eventually is getting down to av_interleaved_write_frame where the AVFormatContext has a valid data stream. -----Original Message----- From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of wm4 Sent: Wednesday, August 13, 2014 10:08 AM To: libav-user at ffmpeg.org Subject: EXTERNAL: Re: [Libav-user] AV_CODEC_ID_SMPTE_KLV not recognized On Wed, 13 Aug 2014 15:53:33 +0000 "Sears, Zachary" wrote: > Hello, > > I am trying to create an application that can add a KLV data stream into an MPEG-TS stream. I started with the muxing.C example and have everything working as far as creating a valid MPEG-TS video, but when I try and include the KLV stream the encoder can't be found. In particular it is failing when I try AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_SMPTE_KLV), it returns with a failure to open the encoder. When I add the video stream the codec id is AV_CODEC_ID_MPEG2VIDEO which it finds perfectly fine and everything works just fine. I am using ffmpeg 2.1.4. > > I also have a known good sample video that has KLV metadata in it and when I try to use ffprobe on that video it finds both streams but returns with "Unsupported codec with id 1263294017 for input stream 1" where input stream 1 is the KLV stream. Could it just be that I missed a flag at compile time, or simply need a newer version of FFMPEG? > > Thanks for any help I have no idea what KLV is, but looking at the source, it seems KLV is supported for demuxing and muxing (in libavformat), but there are no encoders or decoders. I assume this means you have to interpret/generate KLV data yourself. _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user From clark.anthony.g at gmail.com Wed Aug 13 19:50:22 2014 From: clark.anthony.g at gmail.com (Anthony Clark) Date: Wed, 13 Aug 2014 13:50:22 -0400 Subject: [Libav-user] EXTERNAL: Re: AV_CODEC_ID_SMPTE_KLV not recognized In-Reply-To: <4F5821D221CBBD458171BA6BA7C5546A1022B8C8@HDXDSP33.us.lmco.com> References: <4F5821D221CBBD458171BA6BA7C5546A1022B85E@HDXDSP33.us.lmco.com> <20140813180759.58a3b345@debian> <4F5821D221CBBD458171BA6BA7C5546A1022B8C8@HDXDSP33.us.lmco.com> Message-ID: Zachary, I'm attempting to do the *exact* same thing. I'm working on a KLV enc/dec pair for ffmpeg but I will not be able to release it :(. However, if you grep ffmpeg's source (I'm working with 1.2.5), I see plenty of references (~10) to KVL in the MXF files. While this doesn't give a hint on how to create a new stream like you want, you can see it can be done - and I think the mxf KLV stuff is why that codec tag exists in ffmpeg at all. I hope someone else can shed some more light on this. Very soon I will be putting my KLV enc/dec functions into a working ffmpeg "plugin" - thus creating a av_stream with my custom codec (and eventually into an MPEG2 muxer). I wish you luck and I will report back here with my findings / code / progress. Sadly, you shouldn't count on me for this - but I will do my best to rely the information back. -anthony On Wed, Aug 13, 2014 at 1:43 PM, Sears, Zachary wrote: > Thanks for the quick reply, I started down that path and do have code that > generates valid TS packets with KLV data, from what you're saying it sounds > like that was the right path to take. I guess the problem that I keep > getting hung up on after that is how to create the additional stream to > have a type of AVMEDIA_TYPE_VIDEO and at least an id of > AV_CODEC_ID_SMPTE_KLV, from the output of ffprobe it certainly seems like > this is recognized by ffmpeg but I can't figure out how to do it. For the > video stream at least I do avformat_new_stream(avFormatContext, avCodec), > but since there is no codec for the KLV data (NULL is returned from > avcodec_find_encoder), I guess I am a little confused on how to get to that > point. The end that I need to find eventually is getting down to > av_interleaved_write_frame where the AVFormatContext has a valid data > stream. > > > -----Original Message----- > From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] > On Behalf Of wm4 > Sent: Wednesday, August 13, 2014 10:08 AM > To: libav-user at ffmpeg.org > Subject: EXTERNAL: Re: [Libav-user] AV_CODEC_ID_SMPTE_KLV not recognized > > On Wed, 13 Aug 2014 15:53:33 +0000 > "Sears, Zachary" wrote: > > > Hello, > > > > I am trying to create an application that can add a KLV data stream into > an MPEG-TS stream. I started with the muxing.C example and have everything > working as far as creating a valid MPEG-TS video, but when I try and > include the KLV stream the encoder can't be found. In particular it is > failing when I try AVCodec *codec = > avcodec_find_encoder(AV_CODEC_ID_SMPTE_KLV), it returns with a failure to > open the encoder. When I add the video stream the codec id is > AV_CODEC_ID_MPEG2VIDEO which it finds perfectly fine and everything works > just fine. I am using ffmpeg 2.1.4. > > > > I also have a known good sample video that has KLV metadata in it and > when I try to use ffprobe on that video it finds both streams but returns > with "Unsupported codec with id 1263294017 for input stream 1" where input > stream 1 is the KLV stream. Could it just be that I missed a flag at > compile time, or simply need a newer version of FFMPEG? > > > > Thanks for any help > > I have no idea what KLV is, but looking at the source, it seems KLV is > supported for demuxing and muxing (in libavformat), but there are no > encoders or decoders. I assume this means you have to interpret/generate > KLV data yourself. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Wed Aug 13 23:27:11 2014 From: nfxjfg at googlemail.com (wm4) Date: Wed, 13 Aug 2014 23:27:11 +0200 Subject: [Libav-user] EXTERNAL: Re: AV_CODEC_ID_SMPTE_KLV not recognized In-Reply-To: <4F5821D221CBBD458171BA6BA7C5546A1022B8C8@HDXDSP33.us.lmco.com> References: <4F5821D221CBBD458171BA6BA7C5546A1022B85E@HDXDSP33.us.lmco.com> <20140813180759.58a3b345@debian> <4F5821D221CBBD458171BA6BA7C5546A1022B8C8@HDXDSP33.us.lmco.com> Message-ID: <20140813232711.3bed9f03@debian> On Wed, 13 Aug 2014 17:43:30 +0000 "Sears, Zachary" wrote: > Thanks for the quick reply, I started down that path and do have code that generates valid TS packets with KLV data, from what you're saying it sounds like that was the right path to take. I guess the problem that I keep getting hung up on after that is how to create the additional stream to have a type of AVMEDIA_TYPE_VIDEO and at least an id of AV_CODEC_ID_SMPTE_KLV, from the output of ffprobe it certainly seems like this is recognized by ffmpeg but I can't figure out how to do it. For the video stream at least I do avformat_new_stream(avFormatContext, avCodec), but since there is no codec for the KLV data (NULL is returned from avcodec_find_encoder), I guess I am a little confused on how to get to that point. The end that I need to find eventually is getting down to av_interleaved_write_frame where the AVFormatContext has a valid data stream. > To me, it looks like this KLV thing is supported for muxing/demuxing only (as in, libavformat can read and write raw packet data from/to these streams). You're wondering what AVCodec to pass to avformat_new_stream()? It seems the API allows passing NULL. Then you have to initialize the codec fields (not sure which) yourself, though. From adjiev.dmitry at gmail.com Thu Aug 14 13:14:14 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 15:14:14 +0400 Subject: [Libav-user] rtcp doesn't work in rtp muxer Message-ID: Hello. I use rtp muxer for streaming video, but ffplay loses a lot of packets. in rtpenc.c I see the following code: if ((s->first_packet || ((rtcp_bytes >= RTCP_SR_SIZE) && (ff_ntp_time() - s->last_rtcp_ntp_time > 5000000))) && !(s->flags & FF_RTP_FLAG_SKIP_RTCP)) { av_log(NULL, AV_LOG_INFO, "Send rtcp packet\n"); rtcp_send_sr(s1, ff_ntp_time(), 0); s->last_octet_count = s->octet_count; s->first_packet = 0; } value 5000000 seems too large ... What I do wrong? Also what port libavformat uses for rtcp, I think it should be multicast_ip:multicast_port + 1 right? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Thu Aug 14 19:46:57 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 21:46:57 +0400 Subject: [Libav-user] rtsp transport protocol Message-ID: Hello. I trying to use rtsp muxer. By default it has lowertransport tcp, how can I set it to udp? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Thu Aug 14 19:49:34 2014 From: nfxjfg at googlemail.com (wm4) Date: Thu, 14 Aug 2014 19:49:34 +0200 Subject: [Libav-user] rtsp transport protocol In-Reply-To: References: Message-ID: <20140814194934.0336d3a9@debian> On Thu, 14 Aug 2014 21:46:57 +0400 Dmitry Adjiev wrote: > Hello. > I trying to use rtsp muxer. > By default it has lowertransport tcp, how can I set it to udp? I thought it as udp by default? But you can set the "rtsp_transport" AVOption to "udp". From adjiev.dmitry at gmail.com Thu Aug 14 19:51:29 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 21:51:29 +0400 Subject: [Libav-user] rtsp transport protocol In-Reply-To: <20140814194934.0336d3a9@debian> References: <20140814194934.0336d3a9@debian> Message-ID: Here is debug output: Output #0, rtsp, to 'rtsp://127.0.0.1:8554/live.sdp': Stream #0:0: Video: h263, yuv420p, 352x288, q=2-31, 200 kb/s, 15 tbn, 15 tbc [rtsp @ 0x2f688c0] Codec for stream 0 does not use global headers but container format requires global headers [tcp @ 0x2f9eb00] Connection to tcp://127.0.0.1:8554?timeout=0 failed: Connection refused Thanks, I'll try 2014-08-14 21:49 GMT+04:00 wm4 : > On Thu, 14 Aug 2014 21:46:57 +0400 > Dmitry Adjiev wrote: > > > Hello. > > I trying to use rtsp muxer. > > By default it has lowertransport tcp, how can I set it to udp? > > I thought it as udp by default? But you can set the "rtsp_transport" > AVOption to "udp". > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Thu Aug 14 20:00:49 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 22:00:49 +0400 Subject: [Libav-user] rtsp transport protocol In-Reply-To: References: <20140814194934.0336d3a9@debian> Message-ID: This string doesn't work: av_opt_set_from_string(stream->rtp_ctx->priv_data, "rtsp_transport:udp", opts, ":", ":"); This string crashes: av_opt_set_from_string(stream->rtp_ctx->priv_data, "rtsp_transport:udp", opts, ":", NULL); What I do wrong? 2014-08-14 21:51 GMT+04:00 Dmitry Adjiev : > Here is debug output: > > Output #0, rtsp, to 'rtsp://127.0.0.1:8554/live.sdp': > > Stream #0:0: Video: h263, yuv420p, 352x288, q=2-31, 200 kb/s, 15 tbn, 15 > tbc > > [rtsp @ 0x2f688c0] Codec for stream 0 does not use global headers but > container format requires global headers > > [tcp @ 0x2f9eb00] Connection to tcp://127.0.0.1:8554?timeout=0 failed: > Connection refused > > Thanks, I'll try > > > 2014-08-14 21:49 GMT+04:00 wm4 : > > On Thu, 14 Aug 2014 21:46:57 +0400 >> Dmitry Adjiev wrote: >> >> > Hello. >> > I trying to use rtsp muxer. >> > By default it has lowertransport tcp, how can I set it to udp? >> >> I thought it as udp by default? But you can set the "rtsp_transport" >> AVOption to "udp". >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Thu Aug 14 20:08:30 2014 From: nfxjfg at googlemail.com (wm4) Date: Thu, 14 Aug 2014 20:08:30 +0200 Subject: [Libav-user] rtsp transport protocol In-Reply-To: References: <20140814194934.0336d3a9@debian> Message-ID: <20140814200830.59066c25@debian> On Thu, 14 Aug 2014 22:00:49 +0400 Dmitry Adjiev wrote: > This string doesn't work: > av_opt_set_from_string(stream->rtp_ctx->priv_data, "rtsp_transport:udp", > opts, ":", ":"); > > This string crashes: > av_opt_set_from_string(stream->rtp_ctx->priv_data, "rtsp_transport:udp", > opts, ":", NULL); > > What I do wrong? You need to pass it as entry in an AVDictionary to avformat_open_input(). (Not very intuitive, I know.) From adjiev.dmitry at gmail.com Thu Aug 14 20:12:31 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 22:12:31 +0400 Subject: [Libav-user] rtsp transport protocol In-Reply-To: <20140814200830.59066c25@debian> References: <20140814194934.0336d3a9@debian> <20140814200830.59066c25@debian> Message-ID: Thanks for your reply! It will output stream :-) 2014-08-14 22:08 GMT+04:00 wm4 : > On Thu, 14 Aug 2014 22:00:49 +0400 > Dmitry Adjiev wrote: > > > This string doesn't work: > > av_opt_set_from_string(stream->rtp_ctx->priv_data, "rtsp_transport:udp", > > opts, ":", ":"); > > > > This string crashes: > > av_opt_set_from_string(stream->rtp_ctx->priv_data, "rtsp_transport:udp", > > opts, ":", NULL); > > > > What I do wrong? > > You need to pass it as entry in an AVDictionary to > avformat_open_input(). (Not very intuitive, I know.) > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Thu Aug 14 20:18:43 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 22:18:43 +0400 Subject: [Libav-user] rtsp transport protocol In-Reply-To: References: <20140814194934.0336d3a9@debian> <20140814200830.59066c25@debian> Message-ID: Ah, may be I should pass options to avformat_write_header? 2014-08-14 22:12 GMT+04:00 Dmitry Adjiev : > Thanks for your reply! It will output stream :-) > > > > 2014-08-14 22:08 GMT+04:00 wm4 : > > On Thu, 14 Aug 2014 22:00:49 +0400 >> Dmitry Adjiev wrote: >> >> > This string doesn't work: >> > av_opt_set_from_string(stream->rtp_ctx->priv_data, "rtsp_transport:udp", >> > opts, ":", ":"); >> > >> > This string crashes: >> > av_opt_set_from_string(stream->rtp_ctx->priv_data, "rtsp_transport:udp", >> > opts, ":", NULL); >> > >> > What I do wrong? >> >> You need to pass it as entry in an AVDictionary to >> avformat_open_input(). (Not very intuitive, I know.) >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Thu Aug 14 20:25:20 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 22:25:20 +0400 Subject: [Libav-user] rtsp transport protocol In-Reply-To: References: <20140814194934.0336d3a9@debian> <20140814200830.59066c25@debian> Message-ID: AVDictionary *d = NULL; av_dict_set(&d, "rtsp_transport", "udp", 0); ret = avformat_write_header(stream->rtp_ctx, &d); av_dict_free(&d); Has no effect, what I do wrong? 2014-08-14 22:18 GMT+04:00 Dmitry Adjiev : > Ah, may be I should pass options to avformat_write_header? > > > 2014-08-14 22:12 GMT+04:00 Dmitry Adjiev : > > Thanks for your reply! It will output stream :-) >> >> >> >> 2014-08-14 22:08 GMT+04:00 wm4 : >> >> On Thu, 14 Aug 2014 22:00:49 +0400 >>> Dmitry Adjiev wrote: >>> >>> > This string doesn't work: >>> > av_opt_set_from_string(stream->rtp_ctx->priv_data, >>> "rtsp_transport:udp", >>> > opts, ":", ":"); >>> > >>> > This string crashes: >>> > av_opt_set_from_string(stream->rtp_ctx->priv_data, >>> "rtsp_transport:udp", >>> > opts, ":", NULL); >>> > >>> > What I do wrong? >>> >>> You need to pass it as entry in an AVDictionary to >>> avformat_open_input(). (Not very intuitive, I know.) >>> _______________________________________________ >>> Libav-user mailing list >>> Libav-user at ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/libav-user >>> >> >> >> >> -- >> Regards, >> Dmitry >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Thu Aug 14 20:35:49 2014 From: nfxjfg at googlemail.com (wm4) Date: Thu, 14 Aug 2014 20:35:49 +0200 Subject: [Libav-user] rtsp transport protocol In-Reply-To: References: <20140814194934.0336d3a9@debian> <20140814200830.59066c25@debian> Message-ID: <20140814203549.1876a34c@debian> On Thu, 14 Aug 2014 22:25:20 +0400 Dmitry Adjiev wrote: > AVDictionary *d = NULL; > av_dict_set(&d, "rtsp_transport", "udp", 0); > ret = avformat_write_header(stream->rtp_ctx, &d); > av_dict_free(&d); > > Has no effect, what I do wrong? Oh I see, for serving (not reading)... I don't know, in the worst case, it doesn't support UDP. You can check after the write_header call if d still contains the option (if it does, the option wasn't understood). From adjiev.dmitry at gmail.com Thu Aug 14 20:36:58 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 22:36:58 +0400 Subject: [Libav-user] rtsp transport protocol In-Reply-To: <20140814203549.1876a34c@debian> References: <20140814194934.0336d3a9@debian> <20140814200830.59066c25@debian> <20140814203549.1876a34c@debian> Message-ID: I found this, thanks. Dictionary is empty 2014-08-14 22:35 GMT+04:00 wm4 : > On Thu, 14 Aug 2014 22:25:20 +0400 > Dmitry Adjiev wrote: > > > AVDictionary *d = NULL; > > av_dict_set(&d, "rtsp_transport", "udp", 0); > > ret = avformat_write_header(stream->rtp_ctx, &d); > > av_dict_free(&d); > > > > Has no effect, what I do wrong? > > Oh I see, for serving (not reading)... > > I don't know, in the worst case, it doesn't support UDP. You can check > after the write_header call if d still contains the option (if it does, > the option wasn't understood). > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Thu Aug 14 20:42:54 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Thu, 14 Aug 2014 22:42:54 +0400 Subject: [Libav-user] rtsp transport protocol In-Reply-To: References: <20140814194934.0336d3a9@debian> <20140814200830.59066c25@debian> <20140814203549.1876a34c@debian> Message-ID: Then one more question: if I'll use rtp muxer, how can I know rtcp host/port? 2014-08-14 22:36 GMT+04:00 Dmitry Adjiev : > I found this, thanks. Dictionary is empty > > > 2014-08-14 22:35 GMT+04:00 wm4 : > > On Thu, 14 Aug 2014 22:25:20 +0400 >> Dmitry Adjiev wrote: >> >> > AVDictionary *d = NULL; >> > av_dict_set(&d, "rtsp_transport", "udp", 0); >> > ret = avformat_write_header(stream->rtp_ctx, &d); >> > av_dict_free(&d); >> > >> > Has no effect, what I do wrong? >> >> Oh I see, for serving (not reading)... >> >> I don't know, in the worst case, it doesn't support UDP. You can check >> after the write_header call if d still contains the option (if it does, >> the option wasn't understood). >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From sanjosekid82 at gmail.com Fri Aug 15 18:07:54 2014 From: sanjosekid82 at gmail.com (SanJose_kid) Date: Fri, 15 Aug 2014 09:07:54 -0700 Subject: [Libav-user] Patching Libavformat RTP networking stack for packet-loss concealment Message-ID: <21248AC2-4917-4C80-A2A1-552A8DF087AB@gmail.com> We?re patching libavformat in the RTP networking stack in order to be able to: a) get info on package loss and RTP Header Info b) optimize and reduce package loss and error concealment Some issues that have been mentioned by community members include: - whether to use RTP but specify it use TCP for acknowledges and retransmission; - since RTP uses numbering of packets, trying to implement a workaround/concurrent connection for requesting and receiving of lost packets using TCP; - potential complications with dealing with buffering with vbr; - how to best deal with latency while waiting for retransmitted packets (RFC 4588) If any community members are familiar with this and available to offer guidance, we'd greatly appreciate your help and are also willing to sponsor development of this patch to libavformat. Thanks - SanJose_Kid From adjiev.dmitry at gmail.com Sat Aug 16 19:53:19 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sat, 16 Aug 2014 21:53:19 +0400 Subject: [Libav-user] avformat_open_input hangs during opening url rtp://224.0.1.129:1234 Message-ID: Hello. Here my code: void RtpStream::run() { QMutexLocker guard(&mutex_); if (!ip_.isEmpty()) { AVInputFormat* fmt = av_find_input_format(ip_.scheme().toLatin1()); if (!fmt) { qDebug() << "RtpStream: can't finfd format"; return; } AVFormatContext *ctx = avformat_alloc_context(); if (!ctx) qDebug() << "RtpStream: can't alloc context"; int ret = avformat_open_input(&ctx, ip_.toString().toLatin1().constData(), fmt, NULL); qDebug() << "RtpStream: ret " << ret; av_free(fmt); avformat_free_context(ctx); } else qDebug() << "RtpStream: ip number is empty!"; } avformat_open_input hangs. What I do wrong? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sat Aug 16 20:02:08 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sat, 16 Aug 2014 22:02:08 +0400 Subject: [Libav-user] avformat_open_input hangs during opening url rtp://224.0.1.129:1234 In-Reply-To: References: Message-ID: I solved the issue: http://stackoverflow.com/questions/10666242/detecting-a-timeout-in-ffmpeg Thanks for everyone 2014-08-16 21:53 GMT+04:00 Dmitry Adjiev : > Hello. > > Here my code: > > void RtpStream::run() > { > QMutexLocker guard(&mutex_); > > if (!ip_.isEmpty()) { > AVInputFormat* fmt = av_find_input_format(ip_.scheme().toLatin1()); > > if (!fmt) { > qDebug() << "RtpStream: can't finfd format"; > return; > } > > AVFormatContext *ctx = avformat_alloc_context(); > > if (!ctx) > qDebug() << "RtpStream: can't alloc context"; > > int ret = avformat_open_input(&ctx, > ip_.toString().toLatin1().constData(), fmt, NULL); > qDebug() << "RtpStream: ret " << ret; > > > av_free(fmt); > avformat_free_context(ctx); > } > > else > qDebug() << "RtpStream: ip number is empty!"; > } > > avformat_open_input hangs. > What I do wrong? > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sat Aug 16 21:33:21 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sat, 16 Aug 2014 23:33:21 +0400 Subject: [Libav-user] avformat_find_stream_info fails with rtp Message-ID: Hello. Here is my code: void RtpStream::stop() { QMutexLocker guard(&mutex_); stopped_ = true; } void RtpStream::run() { QMutexLocker guard(&mutex_); if (!ip_.isEmpty()) { QSharedPointer fmt (av_find_input_format(ip_.scheme().toLatin1() ), av_free); if (!fmt) { qDebug() << "RtpStream: can't finfd format"; return; } stopped_ = false; AVFormatContext *ctx = avformat_alloc_context(); ctx->interrupt_callback.callback = interruptHandler; ctx->interrupt_callback.opaque = this; int ret = 0; if (!ctx) { qDebug() << "RtpStream: can't alloc context"; ret = avformat_open_input(&ctx, ip_.toString().toLatin1().constData(), NULL, NULL); } else ret = avformat_open_input(&ctx, ip_.toString().toLatin1().constData(), fmt.data(), NULL); if (ctx) sp_fmt_ctx_ = QSharedPointer (ctx, avformat_free_context); qDebug() << "RtpStream ret " << ret; if (ret < 0) { showErrorString(ret, "RtpStream: can't open file"); return; } //av_format_inject_global_side_data(ctx); ret = avformat_find_stream_info(ctx, NULL); if (ret < 0) { showErrorString(ret, "could not find codec parameters"); return; } guard.unlock(); while (!stopped_) { qDebug() << "RtpStream: I need to find decoder :-)"; } } else qDebug() << "RtpStream: ip number is empty!"; } avformat_find_stream_info always fails. What I do wrong? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sat Aug 16 21:33:48 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sat, 16 Aug 2014 23:33:48 +0400 Subject: [Libav-user] avformat_find_stream_info fails with rtp In-Reply-To: References: Message-ID: RtpStream: "could not find codec parameters" reason: "" error code: -110 2014-08-16 23:33 GMT+04:00 Dmitry Adjiev : > Hello. > Here is my code: > > void RtpStream::stop() > { > QMutexLocker guard(&mutex_); > stopped_ = true; > } > > void RtpStream::run() > { > QMutexLocker guard(&mutex_); > > if (!ip_.isEmpty()) { > QSharedPointer fmt > (av_find_input_format(ip_.scheme().toLatin1() ), av_free); > > if (!fmt) { > qDebug() << "RtpStream: can't finfd format"; > return; > } > > stopped_ = false; > AVFormatContext *ctx = avformat_alloc_context(); > ctx->interrupt_callback.callback = interruptHandler; > ctx->interrupt_callback.opaque = this; > int ret = 0; > > if (!ctx) { > qDebug() << "RtpStream: can't alloc context"; > ret = avformat_open_input(&ctx, > ip_.toString().toLatin1().constData(), NULL, NULL); > } else > ret = avformat_open_input(&ctx, > ip_.toString().toLatin1().constData(), fmt.data(), NULL); > > if (ctx) > sp_fmt_ctx_ = QSharedPointer (ctx, > avformat_free_context); > > qDebug() << "RtpStream ret " << ret; > > if (ret < 0) { > showErrorString(ret, "RtpStream: can't open file"); > return; > } > > //av_format_inject_global_side_data(ctx); > > ret = avformat_find_stream_info(ctx, NULL); > > if (ret < 0) { > showErrorString(ret, "could not find codec parameters"); > return; > } > > guard.unlock(); > > while (!stopped_) { > > qDebug() << "RtpStream: I need to find decoder :-)"; > } > } > > else > qDebug() << "RtpStream: ip number is empty!"; > } > > avformat_find_stream_info always fails. > What I do wrong? > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sun Aug 17 03:31:52 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sun, 17 Aug 2014 05:31:52 +0400 Subject: [Libav-user] avformat_find_stream_info connection timedout Message-ID: Hello. I work for android project. On android avformat_find_stream_info fails: D/Qt (18714): RtpStream: "could not find codec parameters" reason: Connection timed out error code: -110 What I do wrong? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sun Aug 17 07:20:01 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sun, 17 Aug 2014 09:20:01 +0400 Subject: [Libav-user] avformat_find_stream_info fails with rtp In-Reply-To: References: Message-ID: I found the reason, it happens because avformat_open_input set nb_streams to 0, but why? .... 2014-08-16 23:33 GMT+04:00 Dmitry Adjiev : > RtpStream: "could not find codec parameters" reason: "" error code: -110 > > > 2014-08-16 23:33 GMT+04:00 Dmitry Adjiev : > > Hello. >> Here is my code: >> >> void RtpStream::stop() >> { >> QMutexLocker guard(&mutex_); >> stopped_ = true; >> } >> >> void RtpStream::run() >> { >> QMutexLocker guard(&mutex_); >> >> if (!ip_.isEmpty()) { >> QSharedPointer fmt >> (av_find_input_format(ip_.scheme().toLatin1() ), av_free); >> >> if (!fmt) { >> qDebug() << "RtpStream: can't finfd format"; >> return; >> } >> >> stopped_ = false; >> AVFormatContext *ctx = avformat_alloc_context(); >> ctx->interrupt_callback.callback = interruptHandler; >> ctx->interrupt_callback.opaque = this; >> int ret = 0; >> >> if (!ctx) { >> qDebug() << "RtpStream: can't alloc context"; >> ret = avformat_open_input(&ctx, >> ip_.toString().toLatin1().constData(), NULL, NULL); >> } else >> ret = avformat_open_input(&ctx, >> ip_.toString().toLatin1().constData(), fmt.data(), NULL); >> >> if (ctx) >> sp_fmt_ctx_ = QSharedPointer (ctx, >> avformat_free_context); >> >> qDebug() << "RtpStream ret " << ret; >> >> if (ret < 0) { >> showErrorString(ret, "RtpStream: can't open file"); >> return; >> } >> >> //av_format_inject_global_side_data(ctx); >> >> ret = avformat_find_stream_info(ctx, NULL); >> >> if (ret < 0) { >> showErrorString(ret, "could not find codec parameters"); >> return; >> } >> >> guard.unlock(); >> >> while (!stopped_) { >> >> qDebug() << "RtpStream: I need to find decoder :-)"; >> } >> } >> >> else >> qDebug() << "RtpStream: ip number is empty!"; >> } >> >> avformat_find_stream_info always fails. >> What I do wrong? >> >> -- >> Regards, >> Dmitry >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sun Aug 17 07:33:34 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sun, 17 Aug 2014 09:33:34 +0400 Subject: [Libav-user] avformat_find_stream_info fails with rtp In-Reply-To: References: Message-ID: It can connect when I change payload type. Anyone? 2014-08-17 9:20 GMT+04:00 Dmitry Adjiev : > I found the reason, it happens because avformat_open_input set nb_streams > to 0, but why? .... > > > 2014-08-16 23:33 GMT+04:00 Dmitry Adjiev : > >> RtpStream: "could not find codec parameters" reason: "" error code: -110 >> >> >> 2014-08-16 23:33 GMT+04:00 Dmitry Adjiev : >> >> Hello. >>> Here is my code: >>> >>> void RtpStream::stop() >>> { >>> QMutexLocker guard(&mutex_); >>> stopped_ = true; >>> } >>> >>> void RtpStream::run() >>> { >>> QMutexLocker guard(&mutex_); >>> >>> if (!ip_.isEmpty()) { >>> QSharedPointer fmt >>> (av_find_input_format(ip_.scheme().toLatin1() ), av_free); >>> >>> if (!fmt) { >>> qDebug() << "RtpStream: can't finfd format"; >>> return; >>> } >>> >>> stopped_ = false; >>> AVFormatContext *ctx = avformat_alloc_context(); >>> ctx->interrupt_callback.callback = interruptHandler; >>> ctx->interrupt_callback.opaque = this; >>> int ret = 0; >>> >>> if (!ctx) { >>> qDebug() << "RtpStream: can't alloc context"; >>> ret = avformat_open_input(&ctx, >>> ip_.toString().toLatin1().constData(), NULL, NULL); >>> } else >>> ret = avformat_open_input(&ctx, >>> ip_.toString().toLatin1().constData(), fmt.data(), NULL); >>> >>> if (ctx) >>> sp_fmt_ctx_ = QSharedPointer (ctx, >>> avformat_free_context); >>> >>> qDebug() << "RtpStream ret " << ret; >>> >>> if (ret < 0) { >>> showErrorString(ret, "RtpStream: can't open file"); >>> return; >>> } >>> >>> //av_format_inject_global_side_data(ctx); >>> >>> ret = avformat_find_stream_info(ctx, NULL); >>> >>> if (ret < 0) { >>> showErrorString(ret, "could not find codec parameters"); >>> return; >>> } >>> >>> guard.unlock(); >>> >>> while (!stopped_) { >>> >>> qDebug() << "RtpStream: I need to find decoder :-)"; >>> } >>> } >>> >>> else >>> qDebug() << "RtpStream: ip number is empty!"; >>> } >>> >>> avformat_find_stream_info always fails. >>> What I do wrong? >>> >>> -- >>> Regards, >>> Dmitry >>> >> >> >> >> -- >> Regards, >> Dmitry >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From emptystate at yahoo.co.uk Sun Aug 17 20:32:03 2014 From: emptystate at yahoo.co.uk (Lyndon Hill) Date: Sun, 17 Aug 2014 19:32:03 +0100 Subject: [Libav-user] Interlacing enum Message-ID: <1408300323.35901.YahooMailNeo@web172604.mail.ir2.yahoo.com> Hi I'm trying to understand AVFieldOrder - can someone confirm my understanding please ? AV_FIELD_TT means even lines represent the field at time t, odd lines represent the field at t+1 AV_FIELD_BB means odd lines represent the field at time t, even lines represent the field at t+1 AV_FIELD_TB means even lines represent the field at time t+1, odd lines represent the field at t. How is this different from BB ? AV_FIELD_BT means what ? I'm lost now. Is it odd lines are actually stored on even lines and this represents the field for t+1 ? I assume that if lines are even then that positioning should be preserved for deinterlacing; and vice-versa ? Thanks in advance. From wadkes93 at gmail.com Mon Aug 18 09:08:11 2014 From: wadkes93 at gmail.com (Ankush Wadke) Date: Mon, 18 Aug 2014 12:38:11 +0530 Subject: [Libav-user] Intel's QuickSync using FFmpeg Message-ID: Hi guys. I have been using FFmpeg for a couple of months now and i also worked on Intel's QuickSync Encoder and Decoder. What i am in need of currently is a way to utilize QuickSync integrated with FFMpeg. I belive there must be a way to use certain flags for using QuickSync for decoding. I also read about the builds for using QSV but couldnt find a proper source to download it. I am working on Windows 7, i7(3rd gen) processor. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From markuspfundstein86 at gmail.com Mon Aug 18 11:31:49 2014 From: markuspfundstein86 at gmail.com (Markus Pfundstein) Date: Mon, 18 Aug 2014 09:33:49 +0002 Subject: [Libav-user] Questions about ColorSpace conversion in swscale Message-ID: <53f1c807.03b3c20a.55c3.fffff0ea@mx.google.com> Hello, I am currently developing a program that uses the libavcodec library for decoding (not encoding) various movie formats. I have some questions about color space conversion and how ffmpeg handles it. Assume I have RGB input where I don't know if its FullRange or ITU-R BT.709 and I want to have my output ITU-R BT.709. How can I configure SwSContext properly? Assume I have YUV422 BT 601 input and I want my output to be YUV444 FullRange. Is this possible without telling SwsContext that my input source is BT 601? I would also appreciate if someone could explain to me how swscale works in terms of color space conversion. I did read through the source and I think I understand a bit but I don't get the whole picture. Does color space conversion work on 10bit and 12bit as well or does it always downscale first to 8bit? (would be a big bummer). Also, does swscale first transform the input color space to XYZ and then transform it further into the target color space? And why is there no yuv2rgb function but only a rgb2yuv function? If I want my output color space to be rgb, such a function would be needed or not? Thanks a lot already for your answers. I hope my english is understandable (not native) With best regards, Markus -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Mon Aug 18 13:50:30 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Mon, 18 Aug 2014 15:50:30 +0400 Subject: [Libav-user] Could not find codec parameters for stream 0 (Video: h263, yuv420p): unspecified size Message-ID: Hello! When I call avformat_find_stream_info fails with this message. What I do wrong? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Aug 18 19:30:04 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 18 Aug 2014 17:30:04 +0000 (UTC) Subject: [Libav-user] Could not find codec parameters for stream 0 (Video: h263, yuv420p): unspecified size References: Message-ID: Dmitry Adjiev writes: > When I call avformat_find_stream_info fails with this message. Does it work with ffmpeg (the application)? Carl Eugen From cehoyos at ag.or.at Mon Aug 18 19:33:52 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 18 Aug 2014 17:33:52 +0000 (UTC) Subject: [Libav-user] Intel's QuickSync using FFmpeg References: Message-ID: Ankush Wadke writes: > What i am in need of currently is a way to > utilize QuickSync integrated with FFMpeg. Why? I mean: Several tests show that QuickSync is not faster than x264 but produces very bad quality. Anyway (this is not the right place to discuss this usage issue): This is ticket #2591 - patch to the developer mailing list welcome! Carl Eugen From cehoyos at ag.or.at Mon Aug 18 19:39:57 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 18 Aug 2014 17:39:57 +0000 (UTC) Subject: [Libav-user] Questions about ColorSpace conversion in swscale References: <53f1c807.03b3c20a.55c3.fffff0ea@mx.google.com> Message-ID: Markus Pfundstein writes: > Assume I have YUV422 BT 601 input and I want my output > to be YUV444 FullRange. Is this possible without telling > SwsContext that my input source is BT 601? How is this supposed to work? (Assuming libswscale is a black box and without discussing its internals: How would it know what you want if you don't set the appropriate options?) > Also, does swscale first transform the input color > space to XYZ and then transform it further into the > target color space? (Sorry if I misunderstand XYZ) This sounds very slow, some conversions use yuv420p as intermediate format (this is what is generally needed for video). It is possible to use yuv444p instead, at least for some conversions. > And why is there no yuv2rgb function but only a > rgb2yuv function? I believe many such functions exist. > If I want my output color space to be rgb, such a > function would be needed or not?? Does yuv->rgb conversion not work for you? I cannot answer some of your questions: If no 16 bit path exist for a conversion you need, it should be possible to add it but currently your information about what you need is very vague. Carl Eugen From adjiev.dmitry at gmail.com Mon Aug 18 19:51:30 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Mon, 18 Aug 2014 21:51:30 +0400 Subject: [Libav-user] Could not find codec parameters for stream 0 (Video: h263, yuv420p): unspecified size In-Reply-To: References: Message-ID: I tested it with ffplay under linux, but not under android. It fails under android only, I have installed ffmpeg for android and I see nothing 2014-08-18 21:30 GMT+04:00 Carl Eugen Hoyos : > Dmitry Adjiev writes: > > > When I call avformat_find_stream_info fails with this message. > > Does it work with ffmpeg (the application)? > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Mon Aug 18 19:53:40 2014 From: nfxjfg at googlemail.com (wm4) Date: Mon, 18 Aug 2014 19:53:40 +0200 Subject: [Libav-user] Questions about ColorSpace conversion in swscale In-Reply-To: <53f1c807.03b3c20a.55c3.fffff0ea@mx.google.com> References: <53f1c807.03b3c20a.55c3.fffff0ea@mx.google.com> Message-ID: <20140818195340.5539caa8@debian> On Mon, 18 Aug 2014 09:33:49 +0002 Markus Pfundstein wrote: > Hello, > > I am currently developing a program that uses the libavcodec library > for decoding (not encoding) various movie formats. I have some > questions about color space conversion and how ffmpeg handles it. > > Assume I have RGB input where I don't know if its FullRange or ITU-R > BT.709 and I want to have my output ITU-R BT.709. How can I configure > SwSContext properly? > > Assume I have YUV422 BT 601 input and I want my output to be YUV444 > FullRange. Is this possible without telling SwsContext that my input > source is BT 601? > > I would also appreciate if someone could explain to me how swscale > works in terms of color space conversion. I did read through the source > and I think I understand a bit but I don't get the whole picture. Does > color space conversion work on 10bit and 12bit as well or does it > always downscale first to 8bit? (would be a big bummer). Also, does > swscale first transform the input color space to XYZ and then transform > it further into the target color space? And why is there no yuv2rgb > function but only a rgb2yuv function? If I want my output color space > to be rgb, such a function would be needed or not? > > Thanks a lot already for your answers. I hope my english is > understandable (not native) > > With best regards, > Markus You have to set them with av_opt_*. Look at libavfilter/vf_scale for an example. Yes, all this stuff is probably under-documented. As for libswscale itself: it's mostly horrible, but with some luck and if you provide the right flags (SWS_BITEXACT and others) it might actually do what you want. From adjiev.dmitry at gmail.com Mon Aug 18 20:20:01 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Mon, 18 Aug 2014 22:20:01 +0400 Subject: [Libav-user] Could not find codec parameters for stream 0 (Video: h263, yuv420p): unspecified size In-Reply-To: References: Message-ID: My code too doesn't works only under android Thanks for your reply! 2014-08-18 21:51 GMT+04:00 Dmitry Adjiev : > I tested it with ffplay under linux, but not under android. > It fails under android only, I have installed ffmpeg for android and I see > nothing > > > 2014-08-18 21:30 GMT+04:00 Carl Eugen Hoyos : > > Dmitry Adjiev writes: >> >> > When I call avformat_find_stream_info fails with this message. >> >> Does it work with ffmpeg (the application)? >> >> Carl Eugen >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From agorapub07 at hotmail.com Sat Aug 16 16:05:27 2014 From: agorapub07 at hotmail.com (Sam William) Date: Sat, 16 Aug 2014 14:05:27 +0000 Subject: [Libav-user] LIBAV RTP - capability for packet loss concealment! Message-ID: Hello,We are using libav's RTP networking stack for low-latency video-conferencing.. We need to add the capability for packet loss concealment into the libav RTP stack Through API or OpenSource.. whichever is best solution? Or how we can use the RTP sequence number to measure the packet loss in a vbr setting in which buffering is required? -------------- next part -------------- An HTML attachment was scrubbed... URL: From artyom148dik at mail.ru Tue Aug 12 15:57:59 2014 From: artyom148dik at mail.ru (=?UTF-8?B?0JDRgNGC0LXQvCDQodGD0YHQu9C+0LI=?=) Date: Tue, 12 Aug 2014 17:57:59 +0400 Subject: [Libav-user] =?utf-8?q?ffmpeg_libraries_turn_off_buffer?= Message-ID: <1407851879.540751121@f394.i.mail.ru> I'm trying to create an application for ios which receives rtsp frames from ip camera. But when I suspend my main thread (for example, minimize my application) and resume it after some time, I see what I read old frame. I think that ffmpeg library create new thread somewhere which fill some buffer with frames. So how can I turn that buffer off? I suppose that I don't need that buffer because I use rtsp over tcp. And I tried to use flag AVFMT_FLAG_NOBUFFER but it did not help. I use ffmpeg 2.3. Thanks PS Probably there in no away to turn this internal buffer off but how I can restrict it? To 1 or 2 frames (or seconds). I tried a lot of variants and have no idea what to do. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddhung at vasc.com.vn Mon Aug 18 15:53:16 2014 From: ddhung at vasc.com.vn (Dang Duc Hung) Date: Mon, 18 Aug 2014 20:53:16 +0700 Subject: [Libav-user] Fix CBR output for IP multicasting video Message-ID: <000001cfbaeb$c64930c0$52db9240$@vasc.com.vn> Hi All. I?m using ffmpeg for transcoding live ip multicasting video on server linux Centos 5.9 OS. This is my ffmpeg command ffmpeg -i "udp:// x.x.x.x:6000?fifo_size=1000000&overrun_nonfatal=1&timeout=1000000" -filter:v yadif=0:-1:1 -vcodec libx264 -vprofile main -level 30 -tune zerolatency -pass 1 -b:v 900k -minrate 900k -maxrate 900k -bufsize 900k -x264opts nal_hrd=cbr:rc_lookahead=40:interlaced=1:scenecut=0:cabac=1:keyint=120:deblock=0,0:aud=1:qpmin=16:qpmax=51:qpstep=10:ref=2:mixed-refs=1:subme=9:me=esa:chroma_me=0:merange=64:8x8dct=0:fast_pskip=0:chroma_qp_offset=0:trellis=2:psy=0:bframes=0:weightp=2:sliced_threads -s:v 720x576 -r:v 25 -force_key_frames 'expr:gte(t,n_forced*3)' -threads 0 -acodec aac -strict -2 -ac 1 -ar 32000 -b:a 32k -filter:a volume=1 -f mpegts -muxrate 1400k udp://x.x.x.x:6000?pkt_size=1316 My output video is for broadcasting so I have to configure CBR video output by feature ?muxrate. But when I watch this stream on VLC the bitrate change very much not constant. The null packet is very high to force cbr mpeg2ts output. Description: cid:image005.jpg at 01CFBB26.63925700 I also measure IP output video by HST3000 JDSU equipment and I see the measurement result is very bad as images. The PCR Jitter, IGMP Latency, Jitter Max which is not good as measurement standard by JDSU Description: cid:image006.jpg at 01CFBB26.63925700 Description: cid:image008.jpg at 01CFBB26.63925700Description: cid:image010.jpg at 01CFBB26.63925700Description: cid:image015.jpg at 01CFBB26.63925700 I try many way to change the ffmpeg command but not successful. The bitrate changes sometime > 1400kbps a lot. I think the problem may be the bitrate not constant. I have heard to change the muxrate output is CBR, it had to be change the code C mpegtsenc.c in libavformat library to new patch. So could you help me fix this problem and make the measurment result is better. Thank you so much. Best Regards ??ng ??c H?ng -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 38843 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 9149 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 29606 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 31146 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 32133 bytes Desc: not available URL: From o.birkedal at sportradar.com Mon Aug 11 12:39:02 2014 From: o.birkedal at sportradar.com (Ole Andre Birkedal) Date: Mon, 11 Aug 2014 12:39:02 +0200 Subject: [Libav-user] FFmpeg thread safety Message-ID: <53E89D46.9050408@sportradar.com> Hi. I'm currently developing a multithreaded C++ program using std::thread. Recently I have been having some crashing issues and it all seems to related non-thread safety of some function in the FFmpeg API. Does there exist an exhausting list of all the function that are not thread safe? - Ole Andre Birkedal From prashanth.bhat at yahoo.com Mon Aug 11 13:10:02 2014 From: prashanth.bhat at yahoo.com (Prashanth Bhat) Date: Mon, 11 Aug 2014 04:10:02 -0700 Subject: [Libav-user] H.264 decoding on Haswell CPU/Xubuntu 14.04 Message-ID: <1407755402.43224.YahooMailNeo@web142801.mail.bf1.yahoo.com> I'm using libavcodec to perform decoding of H.264 frames.? I'm on a Linux environment (14.04 Xubuntu), and Intel Haswell (Pentium grade) CPU. My program decodes the frames, without rendering them on the screen. With 4 simultaneous decodes of 1080p resolution and 15 fps, the CPU utilization is around 90% (not bad), but the load average shown by 'top' is 20+ This looks excessive. I don't think I'm using the hardware decoding ability of the Haswell CPU. Could someone please advise how to find out if I'm effectively using the decoder? The API calls I'm making are pretty standard -? avcodec_register_all(); avcodec_alloc_context3(NULL); avcodec_find_decoder(AV_CODEC_ID_H264); av_parser_init(AV_CODEC_ID_H264); avcodec_open2(); The above calls are made during initialization. The below calls are made on each frame - av_parser_parse2 avcodec_decode_video2 The following points are probably relevant -? a) The default context allocated by avcodec_alloc_context3() does not have any hw_accel associated with it. I allocated a h264_vaapi accelerator, but this doesn't lead to any improvement. b) The codec capabilities does not have the HW_ACCEL bit set. c) The same code worked better when used with Ubuntu 11.10 on a Sandybridge Pentium grade CPU and FFMPEG 0.9 Any help would be appreciated.? Thanks, Prashanth -------------- next part -------------- An HTML attachment was scrubbed... URL: From sunil.morya at agnity.com Thu Aug 14 11:32:25 2014 From: sunil.morya at agnity.com (Sunil Morya) Date: Thu, 14 Aug 2014 15:02:25 +0530 Subject: [Libav-user] can libavcodec notify sli/pli/rpli Message-ID: <003a01cfb7a2$aa103e90$fe30bbb0$@agnity.com> Hi All, To support AVPF (RFC 4585) in RTCP layer. I need support for indication of slice loss, picture loss and reference picture loss from decoder using libavcodec to upper layer RTCP/RTP. Please provide your suggestions , if it is possible using libavcodec. Thanks Sunil -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Mon Aug 18 23:10:30 2014 From: nfxjfg at googlemail.com (wm4) Date: Mon, 18 Aug 2014 23:10:30 +0200 Subject: [Libav-user] FFmpeg thread safety In-Reply-To: <53E89D46.9050408@sportradar.com> References: <53E89D46.9050408@sportradar.com> Message-ID: <20140818231030.651e2f29@debian> On Mon, 11 Aug 2014 12:39:02 +0200 Ole Andre Birkedal wrote: > Hi. > I'm currently developing a multithreaded C++ program using std::thread. > Recently I have been having some crashing issues and it all seems to > related non-thread safety of some function in the FFmpeg API. > > Does there exist an exhausting list of all the function that are not > thread safe? All of them. From patrick at mysonicweb.de Mon Aug 18 23:22:02 2014 From: patrick at mysonicweb.de (Patrick Dehne) Date: Mon, 18 Aug 2014 23:22:02 +0200 Subject: [Libav-user] FFmpeg thread safety In-Reply-To: <20140818231030.651e2f29@debian> References: <53E89D46.9050408@sportradar.com> <20140818231030.651e2f29@debian> Message-ID: <94DB3A89-01EA-4363-BFD5-135D537EEF75@mysonicweb.de> Am 18.08.2014 um 23:10 schrieb wm4 : > On Mon, 11 Aug 2014 12:39:02 +0200 > Ole Andre Birkedal wrote: > >> Hi. >> I'm currently developing a multithreaded C++ program using std::thread. >> Recently I have been having some crashing issues and it all seems to >> related non-thread safety of some function in the FFmpeg API. >> >> Does there exist an exhausting list of all the function that are not >> thread safe? > > All of them. You may want to take a look at the documentation of av_lockmgr_register. From nfxjfg at googlemail.com Mon Aug 18 23:30:07 2014 From: nfxjfg at googlemail.com (wm4) Date: Mon, 18 Aug 2014 23:30:07 +0200 Subject: [Libav-user] FFmpeg thread safety In-Reply-To: <94DB3A89-01EA-4363-BFD5-135D537EEF75@mysonicweb.de> References: <53E89D46.9050408@sportradar.com> <20140818231030.651e2f29@debian> <94DB3A89-01EA-4363-BFD5-135D537EEF75@mysonicweb.de> Message-ID: <20140818233007.7d0d0ef4@debian> On Mon, 18 Aug 2014 23:22:02 +0200 Patrick Dehne wrote: > > Am 18.08.2014 um 23:10 schrieb wm4 : > > > On Mon, 11 Aug 2014 12:39:02 +0200 > > Ole Andre Birkedal wrote: > > > >> Hi. > >> I'm currently developing a multithreaded C++ program using std::thread. > >> Recently I have been having some crashing issues and it all seems to > >> related non-thread safety of some function in the FFmpeg API. > >> > >> Does there exist an exhausting list of all the function that are not > >> thread safe? > > > > All of them. > > You may want to take a look at the documentation of av_lockmgr_register. All functions that are specific to a certain context (like AVCodecContext) are by default not thread-safe. Of course using different contexts at the same time from different threads should be perfectly fine. However, many codecs use some global data that is usually constant, but needs to be initialized once. That's why av_lockmgr_register() exists. It's a very messy way to allocate mutexes that are supposed to coordinate this initialization. However, at least FFmpeg (not Libav) doesn't require this anymore, if you have compiled ffmpeg with threading. It may even be safer not to use the lock manager stuff, because then you avoid library-safety issues. From cehoyos at ag.or.at Mon Aug 18 23:30:22 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 18 Aug 2014 21:30:22 +0000 (UTC) Subject: [Libav-user] H.264 decoding on Haswell CPU/Xubuntu 14.04 References: <1407755402.43224.YahooMailNeo@web142801.mail.bf1.yahoo.com> Message-ID: Prashanth Bhat writes: > c) The same code worked better when used with > Ubuntu 11.10 on a Sandybridge Pentium grade CPU > and FFMPEG 0.9 This sounds very important. Could you either tell us which commit made the code work "worse" or how we can reproduce the issue? Carl Eugen From d3ck0r at gmail.com Tue Aug 19 10:09:44 2014 From: d3ck0r at gmail.com (J Decker) Date: Tue, 19 Aug 2014 01:09:44 -0700 Subject: [Libav-user] FFmpeg thread safety In-Reply-To: <20140818233007.7d0d0ef4@debian> References: <53E89D46.9050408@sportradar.com> <20140818231030.651e2f29@debian> <94DB3A89-01EA-4363-BFD5-135D537EEF75@mysonicweb.de> <20140818233007.7d0d0ef4@debian> Message-ID: On Mon, Aug 18, 2014 at 2:30 PM, wm4 wrote: > All functions that are specific to a certain context (like > AVCodecContext) are by default not thread-safe. Of course using > different contexts at the same time from different threads should be > perfectly fine. > > However, many codecs use some global data that is usually constant, but > needs to be initialized once. That's why av_lockmgr_register() exists. > It's a very messy way to allocate mutexes that are supposed to > coordinate this initialization. > > So if I have lots of videos, and want to play multiple videos at the same time, using separate contexts for each is OK? Or is it not OK because the codecs use globals? Or I have to put critical sections around every call to the library suite? A semi-off-topic question? Why does avcodec-56 allocate so many threads? Why does it need any more threads than the thread I call a decode with? In the example code, decoding audio and video in separate threads didn't require locks? What if I have a thread per video and play 32 on the screen at once? > However, at least FFmpeg (not Libav) doesn't require this anymore, if > you have compiled ffmpeg with threading. It may even be safer not to > use the lock manager stuff, because then you avoid library-safety > issues. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hector.alonso.aparicio at gmail.com Tue Aug 19 11:25:40 2014 From: hector.alonso.aparicio at gmail.com (Hector Alonso) Date: Tue, 19 Aug 2014 11:25:40 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API Message-ID: Hi, I'm developing a H264 decoder in Windows and I want to use the hardware acceleration capabilities: DXVA2 I've already built FFMPEG from git (lastest version: N-65404-gd34ec64; libavcodec 55.73.101 ...) using Mingw64 for 32bits this way: echo 'export PATH=.:/local/bin:/bin:/mingw64/bin' > .profile source .profile git config --global core.autocrlf false git clone git://git.videolan.org/x264.git x264 cd x264 ./configure --host=x86_64-w64-mingw32 --enable-static --enable-shared && make && make install cd .. git clone git://github.com/mstorsjo/fdk-aac.git fdk-aac cd fdk-aac ./autogen.sh ./configure --host=x86_64-w64-mingw32 --enable-static --enable-shared && make && make install cd .. git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg cd ffmpeg ./configure --enable-gpl --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-memalign-hack --enable-runtime-cpudetect --enable-dxva2 --enable-decoder?h264_dxva2 --disable-hwaccels --enable-hwaccel=h264_dxva2 --enable-static --enable-shared --extra-cflags=-I/local/include --extra-ldflags='-L/local/lib -static' && make && make install I've adapted the newest version of ffmpeg_dxva2.c to C++ (with a header file including InputStream, HWAccelID and dxva2_init declarations), now it builds with VisualStudio 2012 and everything is running correctly with my current decoder (not HW accelerated). I found an old post of this list ( https://lists.ffmpeg.org/pipermail/ffmpeg-user/2012-May/006600.html) describing the steps for running it, but now te API has changed... I've also studied the VLC method, but it is also working with the older API (get_buffer instead of get_buffer2, and so). In the newest ffmpeg.c they actually use the hwaccel including DXVA2, but in quite a complicated way... could you please give an example or a piece of advice on how to do it? 1.- Create a InputStream instance, populate it and address it to AVCodecContext->opaque. Which are the needed attributes? It requires width and height of the input before opening it! 2.- call dxva_init() with the decoder AVCodecContext allocated using avcodec_alloc_context3 from CODEC_ID_H264 codec before calling avcodec_open2 ? 3.- Call dxva2_retrieve_data() with the decoder AVCodecContext and a AV_PIX_FMT_NV12 frame when avcodec_decode_video2 returns a complete frame (got_output) ? 4.- Copy (convert) the resulting frame to a YUV420P OpenGL texture, apply a pixelformat conversion shader and show it! <- This step is working fine (I did it for a separated decoder using Intel Media SDK last week). (Future step. - use directly the DX surface using OpenGL extensions.) Now I'm stuck in the first and second steps, when avcodec_decode_video2 is called it crashes. I've debugged step by step the dxva initialization and the DX surfaces are being created correctly. What am I missing? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From markuspfundstein86 at gmail.com Tue Aug 19 11:50:33 2014 From: markuspfundstein86 at gmail.com (Markus Pfundstein) Date: Tue, 19 Aug 2014 11:50:33 +0200 Subject: [Libav-user] Questions about ColorSpace conversion in swscale In-Reply-To: References: <53f1c807.03b3c20a.55c3.fffff0ea@mx.google.com> Message-ID: Hi Carl, thanks for your answers. Please see my remarks. >> Assume I have YUV422 BT 601 input and I want my output >> to be YUV444 FullRange. Is this possible without telling >> SwsContext that my input source is BT 601? > How is this supposed to work? > (Assuming libswscale is a black box and without discussing > its internals: How would it know what you want if you >don't set the appropriate options?) Yes, you are right. I think the user has to specify what the input color space is. Its quite logical actually. >> Also, does swscale first transform the input color >> space to XYZ and then transform it further into the >> target color space? > (Sorry if I misunderstand XYZ) > This sounds very slow, some conversions use yuv420p as > intermediate format (this is what is generally needed > for video). It is possible to use yuv444p instead, at > least for some conversions. If yuv420p is used as an intermediate format, wouldnt that result into heavy information loss? Assume I want to convert from rgb fullrange to yuv444 BT709. If the intermediate color space would be yuv420, my chroma samples would be quarted and then again interpolated. Thats not acceptable I guess. Thats why I was wondering if XYZ is used as intermediate format as it can store all color spaces that exist. >> And why is there no yuv2rgb function but only a >> rgb2yuv function? > I believe many such functions exist. Couldn't find them. But I must dig further into the source code. For the beginning, it would be great to get high level overview over how swscale is working. >> If I want my output color space to be rgb, such a >> function would be needed or not? > Does yuv->rgb conversion not work for you? It does. Sorry for the missunderstanding. Everything works fine. I do 10bit and 12bit conversion with yuv2yuv, rgb2yuv, yuv2rgb etc. The color space is my big question mark. > I cannot answer some of your questions: If no 16 bit > path exist for a conversion you need, it should be > possible to add it but currently your information > about what you need is very vague. This is something I would like to know from the swscale developer. Are there 16bit paths or is the conversion done via 8bit? This would be a big loss. > Carl Eugen Thanks On Mon, Aug 18, 2014 at 7:39 PM, Carl Eugen Hoyos wrote: > Markus Pfundstein writes: > > > Assume I have YUV422 BT 601 input and I want my output > > to be YUV444 FullRange. Is this possible without telling > > SwsContext that my input source is BT 601? > > How is this supposed to work? > (Assuming libswscale is a black box and without discussing > its internals: How would it know what you want if you > don't set the appropriate options?) > > > Also, does swscale first transform the input color > > space to XYZ and then transform it further into the > > target color space? > > (Sorry if I misunderstand XYZ) > This sounds very slow, some conversions use yuv420p as > intermediate format (this is what is generally needed > for video). It is possible to use yuv444p instead, at > least for some conversions. > > > And why is there no yuv2rgb function but only a > > rgb2yuv function? > > I believe many such functions exist. > > > If I want my output color space to be rgb, such a > > function would be needed or not? > > Does yuv->rgb conversion not work for you? > > I cannot answer some of your questions: If no 16 bit > path exist for a conversion you need, it should be > possible to add it but currently your information > about what you need is very vague. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Tue Aug 19 19:36:34 2014 From: nfxjfg at googlemail.com (wm4) Date: Tue, 19 Aug 2014 19:36:34 +0200 Subject: [Libav-user] FFmpeg thread safety In-Reply-To: References: <53E89D46.9050408@sportradar.com> <20140818231030.651e2f29@debian> <94DB3A89-01EA-4363-BFD5-135D537EEF75@mysonicweb.de> <20140818233007.7d0d0ef4@debian> Message-ID: <20140819193634.5f32915b@debian> On Tue, 19 Aug 2014 01:09:44 -0700 J Decker wrote: > On Mon, Aug 18, 2014 at 2:30 PM, wm4 wrote: > > > All functions that are specific to a certain context (like > > AVCodecContext) are by default not thread-safe. Of course using > > different contexts at the same time from different threads should be > > perfectly fine. > > > > However, many codecs use some global data that is usually constant, but > > needs to be initialized once. That's why av_lockmgr_register() exists. > > It's a very messy way to allocate mutexes that are supposed to > > coordinate this initialization. > > > > > So if I have lots of videos, and want to play multiple videos at the same > time, using separate contexts for each is OK? Or is it not OK because the > codecs use globals? The globals are things like huge tables, which are constant, but it's easier/smaller to initialize them at startup, instead of hardcoding them into the binary. So, on opening the codec context, these tables are initialized (if they aren't already). So it should be ok, as long as initialization doesn't go wrong. Supporting threads is a huge mess, partly because ffmpeg supports many legacy architectures. The "lock manager" stuff was probably meant to allow the user to plugin exotic threading APIs (pure non-sense if you ask me). Now there's a default "lock manager". It's usually enabled by default, but AFAIK depends on threading support within ffmpeg. So make sure you didn't accidentally disable threading. If you're using Libav (the ffmpeg fork shipped with Ubuntu, Debian), or if you're using an ancient version of ffmpeg, be aware that it won't have that default lock manager. Functions like avcodec_register_all() still need to be synchronized. > Or I have to put critical sections around every call to the library suite? No, you just have to synchronize access to each context. Generally, ffmpeg code do any locking for the user. (It only does locking to coordinate internal threads, not more.) > A semi-off-topic question? Why does avcodec-56 allocate so many threads? > Why does it need any more threads than the thread I call a decode with? libavcodec supports multithreaded decoding. I forgot, maybe it's default now? > In the example code, decoding audio and video in separate threads didn't > require locks? What if I have a thread per video and play 32 on the screen > at once? That should work fine. From swapnil.bhoite28 at gmail.com Wed Aug 20 14:38:27 2014 From: swapnil.bhoite28 at gmail.com (Swapnil Bhoite) Date: Wed, 20 Aug 2014 18:08:27 +0530 Subject: [Libav-user] ffmpeg with Android Message-ID: Hi, I am working on Android (Compiled ffmpeg-2.3.3 for Android on Ubuntu 12.04). The basic purpose of my project is open and play HLS. I've been searching on internet for doing so, but I'm unable to find useful guidance. Looking forward for further guidance. >From examples, I have created one to get metadata of file. It is working fine for local file but avformat_open_input(...) returning -5(I/O error) if online URL is passed as input file name. Thank you, -Swapnil -------------- next part -------------- An HTML attachment was scrubbed... URL: From ch_mike at mail.ru Wed Aug 20 16:16:20 2014 From: ch_mike at mail.ru (Mike Charikov) Date: Wed, 20 Aug 2014 18:16:20 +0400 Subject: [Libav-user] Question about avdevice_list_devices() using. Message-ID: <001801cfbc81$5105a040$f310e0c0$@mail.ru> Hi! I try to use avdevice_list_devices() for getting list of video devices, but don?t clearly understand, how to do that properly. How should I properly init AVFormatContext for calling avdevice_list_devices()? Tried something like that: int main() { avdevice_register_all(); avcodec_register_all(); AVFormatContext* format_context = avformat_alloc_context(); AVInputFormat *fmt = av_find_input_format("dshow"); AVDeviceInfoList *device_list=NULL; int err = avformat_open_input(&format_context, NULL, fmt, NULL); if (err != 0) { fprintf(stderr, "ffmpeg: Unable to open input: %d\n", err); } int i = avdevice_list_devices(format_context, &device_list); return 0; } But avformat_open_input() returns error (code -1414092869), and so does avdevice_list_devices() (code -40) -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.orr at scala.com Wed Aug 20 17:32:12 2014 From: john.orr at scala.com (John Orr) Date: Wed, 20 Aug 2014 11:32:12 -0400 Subject: [Libav-user] FFmpeg thread safety In-Reply-To: <94DB3A89-01EA-4363-BFD5-135D537EEF75@mysonicweb.de> References: <53E89D46.9050408@sportradar.com> <20140818231030.651e2f29@debian> <94DB3A89-01EA-4363-BFD5-135D537EEF75@mysonicweb.de> Message-ID: <53F4BF7C.4000100@scala.com> On 8/18/2014 5:22 PM, Patrick Dehne wrote: > Am 18.08.2014 um 23:10 schrieb wm4 : > >> On Mon, 11 Aug 2014 12:39:02 +0200 >> Ole Andre Birkedal wrote: >> >>> Hi. >>> I'm currently developing a multithreaded C++ program using std::thread. >>> Recently I have been having some crashing issues and it all seems to >>> related non-thread safety of some function in the FFmpeg API. >>> >>> Does there exist an exhausting list of all the function that are not >>> thread safe? >> All of them. > You may want to take a look at the documentation of av_lockmgr_register. Certain ffmpeg open and close functions need to be serialized across all threads. These include avformat_open_input/avformat_close_input and avcodec_open/avcodec_close. By default ffmpeg assumes your app is single threaded and doesn't need locking, so the underlying "locks" are no-ops. There is a function, av_lockmgr_register, that allows the app to provide your locking mechanism. The docs for avcodec_open/close and avformat_open/close_input do not mention av_lockmgr_register. It wasn't until I looked through ffmpeg source code and found the no-op locking mechanism that I found out about av_lockmgr_register. That gave me something to google for, so I found some discussions about it, like this one: http://stackoverflow.com/questions/13888915/thread-safety-of-libav-ffmpeg --Johno From nfxjfg at googlemail.com Wed Aug 20 18:42:14 2014 From: nfxjfg at googlemail.com (wm4) Date: Wed, 20 Aug 2014 18:42:14 +0200 Subject: [Libav-user] FFmpeg thread safety In-Reply-To: <53F4BF7C.4000100@scala.com> References: <53E89D46.9050408@sportradar.com> <20140818231030.651e2f29@debian> <94DB3A89-01EA-4363-BFD5-135D537EEF75@mysonicweb.de> <53F4BF7C.4000100@scala.com> Message-ID: <20140820184214.049b7d6d@debian> On Wed, 20 Aug 2014 11:32:12 -0400 John Orr wrote: > On 8/18/2014 5:22 PM, Patrick Dehne wrote: > > Am 18.08.2014 um 23:10 schrieb wm4 : > > > >> On Mon, 11 Aug 2014 12:39:02 +0200 > >> Ole Andre Birkedal wrote: > >> > >>> Hi. > >>> I'm currently developing a multithreaded C++ program using std::thread. > >>> Recently I have been having some crashing issues and it all seems to > >>> related non-thread safety of some function in the FFmpeg API. > >>> > >>> Does there exist an exhausting list of all the function that are not > >>> thread safe? > >> All of them. > > You may want to take a look at the documentation of av_lockmgr_register. > > > Certain ffmpeg open and close functions need to be serialized across all > threads. > > These include avformat_open_input/avformat_close_input and > avcodec_open/avcodec_close. > > By default ffmpeg assumes your app is single threaded and doesn't need > locking, so the underlying "locks" are no-ops. There is a function, > av_lockmgr_register, that allows the app to provide your locking mechanism. > > The docs for avcodec_open/close and avformat_open/close_input do not > mention av_lockmgr_register. It wasn't until I looked through ffmpeg > source code and found the no-op locking mechanism that I found out about > av_lockmgr_register. That gave me something to google for, so I found > some discussions about it, like this one: Like I mentioned in the other email, as long as ffmpeg is compiled with threading, and is recent enough, a default "lock manager" is set. > > http://stackoverflow.com/questions/13888915/thread-safety-of-libav-ffmpeg > > > --Johno > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From cehoyos at ag.or.at Thu Aug 21 13:45:09 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 21 Aug 2014 11:45:09 +0000 (UTC) Subject: [Libav-user] Questions about ColorSpace conversion in swscale References: <53f1c807.03b3c20a.55c3.fffff0ea@mx.google.com> Message-ID: Markus Pfundstein writes: > some conversions use yuv420p as> intermediate format > (this is what is generally needed> for video). It is > possible to use yuv444p instead, at> least for some > conversions. > > If yuv420p is used as an intermediate format, > wouldnt that result into heavy information loss? As said, you can force libswscale to use yuv444p as intermediate format which makes conversion slower which is often undesired. [...] > Assume I want to convert from rgb fullrange to > yuv444 BT709. In this case, no intermediate colour space should be used. [...] > This is something I would like to know from the > swscale developer. Are there 16bit paths or is > the conversion done via 8bit? As said, if you find that a 16bit path is missing, please explain how I can reproduce this. Carl Eugen From daytooner at gmail.com Thu Aug 21 19:17:52 2014 From: daytooner at gmail.com (daytooner) Date: Thu, 21 Aug 2014 10:17:52 -0700 (PDT) Subject: [Libav-user] Can't convert raw audio to mp3 Message-ID: <1408641472516-4660311.post@n4.nabble.com> I have a raw audio file (s16, 44100, 2 channels). FWIW, the file was generated from a FLAC file, and I have tested it in audacity and it is fine. I am now trying to convert that to an mp3 file. The code I am using follows. (Note that I have removed a lot of insignificant lines, such as #includes). /************************* begin code ******************************** flac2mp3.cpp */ # many includes/macros # typedef unsigned char BYTE; static AVFormatContext *encfmt_ctx = NULL; static AVCodecContext *audio_enc_ctx; static AVStream *audio_encstream = NULL; static int audio_frame_deccount = 0, audio_frame_enccount = 0; static SwrContext *swr; #define MP3_SAMPLE_FMT AV_SAMPLE_FMT_S16P #define MP3_BITRATE 256000 #define MP3_SAMPLE_RATE 44100 #define FLAC_SAMPLE_FMT AV_SAMPLE_FMT_S16 #define FLAC_BITRATE 256000 #define FLAC_SAMPLE_RATE 44100 #define SAMPLES_TO_CB(stc, cs) (av_get_bytes_per_sample(stc->codec->sample_fmt) * stc->codec->channels * cs) #define SAMPLES_FROM_CB(stc, cb) cb/(av_get_bytes_per_sample(stc->codec->sample_fmt) * stc->codec->channels) #define BYTES_TO_READ 4594 void flush_audio() { int ret; int got_frame; AVPacket epkt = {0}; av_init_packet(&epkt); do { ret = avcodec_encode_audio2(audio_enc_ctx, &epkt, NULL, &got_frame); av_assert0(ret >= 0); }while(got_frame); } /* * encode a buffer of cbdec bytes of raw audio */ bool encode_buffer(BYTE* buff, int cbdec) { int ret; int got_frame; int line_size; BYTE* ob[2]; const BYTE* ib[2]; AVPacket epkt = {0}; AVFrame *eframe = avcodec_alloc_frame(); av_init_packet(&epkt); /* * convert audio */ long int c_insamples = cbdec/(4); // long int delay = swr_get_delay(swr,(long int) 44100); long int delay = 0; int c_outsamples = av_rescale_rnd(delay + c_insamples, (long int) MP3_SAMPLE_RATE, (long int) FLAC_SAMPLE_RATE, AV_ROUND_UP); ret = av_samples_alloc(ob, &line_size, 2, c_outsamples,MP3_SAMPLE_FMT, 0); av_assert0(ret >= 0); ib[0] = buff; ret = swr_convert(swr, ob, c_outsamples, ib, c_insamples); av_assert0(ret >= 0); /* * encode */ eframe->nb_samples = cbdec/(4); eframe->pts = (audio_frame_deccount * ( av_rescale_q(1, audio_encstream->codec->time_base, audio_encstream->time_base))); avcodec_fill_audio_frame(eframe, 2, MP3_SAMPLE_FMT, ob[0], cbdec, 1); epkt.stream_index = audio_encstream->index; eframe->nb_samples = audio_enc_ctx->frame_size; ret = avcodec_encode_audio2(audio_enc_ctx, &epkt, eframe, &got_frame); av_assert0(ret >= 0); audio_frame_deccount +=(cbdec/4); printf("cbdec=%d, decoded=%d pts=%ld\n", cbdec, audio_frame_deccount, eframe->pts); if (!got_frame) { return false; } epkt.stream_index = audio_encstream->index; audio_frame_enccount ++ ; /* Write the compressed frame to the media file. */ ret = av_interleaved_write_frame(encfmt_ctx, &epkt); av_free(ob[0]); avcodec_free_frame(&eframe); return true; } int open_encodec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) { int ret; AVStream *st; AVCodec *enc = NULL; enc = avcodec_find_encoder(fmt_ctx->oformat->audio_codec); av_assert0(enc != NULL); st = avformat_new_stream(fmt_ctx, enc); /* find encoder for the stream */ st->codec->sample_fmt = MP3_SAMPLE_FMT; st->codec->bit_rate = MP3_BITRATE; st->codec->sample_rate = MP3_SAMPLE_RATE; st->codec->channels = 2; st->codec->channel_layout = 3; ret = avcodec_open2(st->codec, enc, NULL); av_assert0(ret >= 0); return 1; } int main(int argc, char **argv) { const char *fn_out = argv[1]; int ret; av_register_all(); ret = avformat_alloc_output_context2(&encfmt_ctx, NULL, NULL, fn_out); av_assert0(ret >= 0); if (open_encodec_context(encfmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) { audio_encstream = encfmt_ctx->streams[0]; audio_enc_ctx = audio_encstream->codec; av_dump_format(encfmt_ctx, 0, fn_out, 1); } swr = swr_alloc(); av_assert0(swr); /* set options */ av_opt_set_int(swr, "in_channel_layout", 3, 0); av_opt_set_int(swr, "in_channel_count", 2, 0); av_opt_set_int(swr, "in_sample_rate", FLAC_SAMPLE_RATE,0); av_opt_set_sample_fmt(swr, "in_sample_fmt", FLAC_SAMPLE_FMT, 0); av_opt_set_int(swr, "out_channel_layout",3, 0); av_opt_set_int(swr, "out_sample_rate", MP3_SAMPLE_RATE, 0); av_opt_set_sample_fmt(swr, "out_sample_fmt",MP3_SAMPLE_FMT, 0); ret = swr_init(swr); av_assert0(ret >= 0); if (!(encfmt_ctx->oformat->flags & AVFMT_NOFILE)) { ret = avio_open(&encfmt_ctx->pb, fn_out, AVIO_FLAG_WRITE); av_assert0(ret >= 0); } ret = avformat_write_header(encfmt_ctx, NULL); av_assert0(ret >= 0); int cbread = 0; int fd = open("/nas/temp/flac.raw", O_RDONLY); assert(fd > 0); int cb2read = BYTES_TO_READ; BYTE b[cb2read]; int c_reads = 0; while ((cbread = read(fd, b, cb2read)) > 0) { c_reads++; encode_buffer(b, cbread); } avcodec_flush_buffers(audio_enc_ctx); flush_audio(); close(fd); ret = av_interleaved_write_frame(encfmt_ctx, NULL); av_assert0(ret >= 0); av_write_trailer(encfmt_ctx); avio_close(encfmt_ctx->pb); avcodec_close(audio_enc_ctx); avformat_free_context(encfmt_ctx); exit(1); } /**************** end code *************************/ I have discovered that if I change the number of bytes read in and encoded (BYTES_TO_READ), that the output changes. I experimented with different values, and the value 4594 seems to get the closest to the original audio - although it it about 0.5 seconds longer and the audio is choppy. Also, with some values of BYTES_TO_READ, the avcodec_encode_audio2 call fails, with an error of "not enough bytes". I would like to transcode directly from the flac file to mp3, as the ffmpeg command line does, as well as take raw audio and encode it to mp3 and other formats. So, the basic question is: what is wrong with the above code? I have pieced this together from the various libav samples on the ffmpeg website. Also, in the future, I will need to do the same thing with video - encode raw video in various pixel formats. So, any help here is greatly appreciated. TIA ken PS: sorry for the long message, but I did feel the code was important. -- View this message in context: http://libav-users.943685.n4.nabble.com/Can-t-convert-raw-audio-to-mp3-tp4660311.html Sent from the libav-users mailing list archive at Nabble.com. From markuspfundstein86 at gmail.com Thu Aug 21 19:21:16 2014 From: markuspfundstein86 at gmail.com (Markus Pfundstein) Date: Thu, 21 Aug 2014 19:21:16 +0200 Subject: [Libav-user] Questions about ColorSpace conversion in swscale In-Reply-To: References: <53f1c807.03b3c20a.55c3.fffff0ea@mx.google.com> Message-ID: Hi eugen, many thanks for your answers. > As said, you can force libswscale to use yuv444p > as intermediate format which makes conversion > slower which is often undesired. Can you please tell me how? Is it a flag? Gr Markus On Thu, Aug 21, 2014 at 1:45 PM, Carl Eugen Hoyos wrote: > Markus Pfundstein writes: > > > some conversions use yuv420p as> intermediate format > > (this is what is generally needed> for video). It is > > possible to use yuv444p instead, at> least for some > > conversions. > > > > If yuv420p is used as an intermediate format, > > wouldnt that result into heavy information loss? > > As said, you can force libswscale to use yuv444p > as intermediate format which makes conversion > slower which is often undesired. > > [...] > > > Assume I want to convert from rgb fullrange to > > yuv444 BT709. > > In this case, no intermediate colour space should > be used. > > [...] > > > This is something I would like to know from the > > swscale developer. Are there 16bit paths or is > > the conversion done via 8bit? > > As said, if you find that a 16bit path is missing, > please explain how I can reproduce this. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yannick.kohn at modulo-pi.com Thu Aug 21 22:28:52 2014 From: yannick.kohn at modulo-pi.com (yannick.kohn at modulo-pi.com) Date: Thu, 21 Aug 2014 20:28:52 +0000 Subject: [Libav-user] freelance developer needed Message-ID: Hi, I am trying to find a freelance developper for adding ffmpeg support to our software. Best regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Thu Aug 21 22:31:42 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 22 Aug 2014 00:31:42 +0400 Subject: [Libav-user] freelance developer needed In-Reply-To: References: Message-ID: Hello. What exactly do you need? 2014-08-22 0:28 GMT+04:00 yannick.kohn at modulo-pi.com < yannick.kohn at modulo-pi.com>: > Hi, > > I am trying to find a freelance developper for adding ffmpeg support to > our software. > > Best regards, > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From emptystate at yahoo.co.uk Thu Aug 21 23:37:20 2014 From: emptystate at yahoo.co.uk (Lyndon Hill) Date: Thu, 21 Aug 2014 22:37:20 +0100 Subject: [Libav-user] Writing Interlaced Video Message-ID: <1408657040.42521.YahooMailNeo@web172603.mail.ir2.yahoo.com> Nils Jessen wrote: > I would like to get some help writing interlaced video correctly flagged > as interlaced. Your problem is that V210 is a raw format. There are no interlacing flags in V210. You also want to write using the AVI container; AVI does not explicitly support interlacing. You can dump interlaced frames to AVI but without prior knowledge or visual inspection there is no way for software to know. On the other hand QuickTime mov format supports interlacing, this is the reason why you had success with it. Lyndon Hill From emptystate at yahoo.co.uk Fri Aug 22 00:53:57 2014 From: emptystate at yahoo.co.uk (Lyndon Hill) Date: Thu, 21 Aug 2014 23:53:57 +0100 Subject: [Libav-user] Reading packed BGR format Message-ID: <1408661637.25524.YahooMailNeo@web172606.mail.ir2.yahoo.com> Hi, I'm trying to read a simple AVI file with raw BGR. This codec is the default and sometimes referred to as "DIB". I can open the file and decode frames of format AV_PIX_FMT_BGR24 but the problem is that I'm getting AVFrame.linesize[0] = -2160. I know this file is 720x480. Why the negative ? AVFrame.data[0] certainly does not point to a frame of 2160 bytes. If I use swscale() to convert to AV_PIX_FMT_RGB24 then it seems to handle the conversion fine. None of this makes sense to me. From cehoyos at ag.or.at Fri Aug 22 01:11:40 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 21 Aug 2014 23:11:40 +0000 (UTC) Subject: [Libav-user] Reading packed BGR format References: <1408661637.25524.YahooMailNeo@web172606.mail.ir2.yahoo.com> Message-ID: Lyndon Hill writes: > I can open the file and decode frames of format > AV_PIX_FMT_BGR24 but the problem is that I'm > getting AVFrame.linesize[0] = -2160. Meaning the frame is top-down which is normal for rawvideo in avi. You don't have to care about this at all: The data pointer still points to the "first" row and you still have to add linesize to find the "second" row. Carl Eugen From adjiev.dmitry at gmail.com Fri Aug 22 04:49:10 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 22 Aug 2014 06:49:10 +0400 Subject: [Libav-user] rtcp in multicasting Message-ID: Hello. I have one question: should I send rtcp to multicast group? -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas.derouineau at vitec.com Fri Aug 22 14:09:59 2014 From: nicolas.derouineau at vitec.com (Nicolas Derouineau) Date: Fri, 22 Aug 2014 12:09:59 +0000 Subject: [Libav-user] Debug level Message-ID: <1408709399071.67802@vitec.com> Hello, I'm currently playing with libavcodec as a static library, and I would like to get the debug message (printed by the following)?????????????? ? ??? av_log(h->avctx, AV_LOG_DEBUG, ?????????????????????? "NAL_IDR Detected\n"); Only the message printed with ??? av_log(h->avctx, AV_LOG_ERROR, ?????????????????????? "NAL_IDR Detected\n"); are currently displayed. Does anyone know how to activate this ? I see a DEBUGLEVEL option in the configure script, but no further description is given. Regards, Nicolas From vtilakece at gmail.com Fri Aug 22 14:20:55 2014 From: vtilakece at gmail.com (Tilak Varisetty) Date: Fri, 22 Aug 2014 14:20:55 +0200 Subject: [Libav-user] Debug level In-Reply-To: <1408709399071.67802@vitec.com> References: <1408709399071.67802@vitec.com> Message-ID: I think the flags AV_LOG_DEBUG, AV_LOG_ERROR are enabled based on the importance level of the logged function av_log(). To log all the info you can use av_log(NULL, AV_LOG_INFO, "Message to be displayed"); I am not sure if you wanted to know the above information. Regards, Tilak. On Fri, Aug 22, 2014 at 2:09 PM, Nicolas Derouineau < nicolas.derouineau at vitec.com> wrote: > Hello, > > I'm currently playing with libavcodec as a static library, and I would > like to get the debug message (printed by the following) > > av_log(h->avctx, AV_LOG_DEBUG, > "NAL_IDR Detected\n"); > > Only the message printed with > > av_log(h->avctx, AV_LOG_ERROR, > "NAL_IDR Detected\n"); > > are currently displayed. Does anyone know how to activate this ? I see a > DEBUGLEVEL option in the configure script, but no further description is > given. > > Regards, > > Nicolas > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From clark.anthony.g at gmail.com Sat Aug 23 01:06:39 2014 From: clark.anthony.g at gmail.com (Anthony Clark) Date: Fri, 22 Aug 2014 19:06:39 -0400 Subject: [Libav-user] rtcp in multicasting In-Reply-To: References: Message-ID: Dmitry, The point of RTCP is to provide feedback from each connected client/receiver. This would not make sense to be multicast. Though, if your talking about the RTP server, then that might depend on the spec... It's all in the RFC of course. -AC On Aug 21, 2014, at 10:49 PM, Dmitry Adjiev wrote: > Hello. > I have one question: should I send rtcp to multicast group? > -- > Regards, > Dmitry > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From dantmnf2 at gmail.com Sat Aug 23 16:13:32 2014 From: dantmnf2 at gmail.com (dant) Date: Sat, 23 Aug 2014 22:13:32 +0800 Subject: [Libav-user] cannot remux some files using the sample code Message-ID: Hello, I am learning how to use libavformat to remux a file and I found this: doc/samples/remuxing.c However, I run into some troubles:
% ./remuxing a.mkv b.mp4
Input #0, matroska,webm, from 'a.mkv':
  Metadata:
    ENCODER         : Lavf55.19.104
  Duration: 00:01:33.18, start: 0.083000, bitrate: 1723 kb/s
    Stream #0:0(jpn): Video: h264 (High), yuv420p, 1280x720 [SAR 1:1
DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(jpn): Audio: aac, 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : Japanese Audio
      LANGUAGE        : jpn
Output #0, mp4, to 'b.mp4':
    Stream #0:0: Video: h264, yuv420p, 1280x720 [SAR 1:1 DAR 16:9],
q=2-31, 47.95 tbc
    Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp
[mp4 @ 0xb7ede0] Using AVStream.codec.time_base as a timebase hint to
the muxer is deprecated. Set AVStream.time_base instead.
[mp4 @ 0xb7ede0] Using AVStream.codec.time_base as a timebase hint to
the muxer is deprecated. Set AVStream.time_base instead.
in: pts:83 pts_time:0.083 dts:NOPTS dts_time:NOPTS duration:0
duration_time:0 stream_index:0
out: pts:3984 pts_time:0.083 dts:NOPTS dts_time:NOPTS duration:0
duration_time:0 stream_index:0
in: pts:542 pts_time:0.542 dts:NOPTS dts_time:NOPTS duration:41
duration_time:0.041 stream_index:0
out: pts:26016 pts_time:0.542 dts:NOPTS dts_time:NOPTS duration:1968
duration_time:0.041 stream_index:0
[mp4 @ 0xb7ede0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 3984 >= 3984
Error muxing packet
Error occurred: Invalid argument
PS. Everything is OK when I use "ffmpeg -i a.mkv -c copy b.mp4" to do it. From adjiev.dmitry at gmail.com Sat Aug 23 17:04:53 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sat, 23 Aug 2014 19:04:53 +0400 Subject: [Libav-user] rtcp in multicasting In-Reply-To: References: Message-ID: Thanks for your reply. Project works on android. 40 clients should work with server, but when we connect 15 first 3-5 devices don't show video, they like hang (stop play video). What should I do for fixing this? Will rtcp fix this? 2014-08-23 3:06 GMT+04:00 Anthony Clark : > Dmitry, > > The point of RTCP is to provide feedback from each connected > client/receiver. This would not make sense to be multicast. Though, if your > talking about the RTP server, then that might depend on the spec... It's > all in the RFC of course. > > -AC > > > On Aug 21, 2014, at 10:49 PM, Dmitry Adjiev > wrote: > > > Hello. > > I have one question: should I send rtcp to multicast group? > > -- > > Regards, > > Dmitry > > _______________________________________________ > > Libav-user mailing list > > Libav-user at ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/libav-user > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sat Aug 23 17:24:48 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sat, 23 Aug 2014 19:24:48 +0400 Subject: [Libav-user] Debug level In-Reply-To: References: <1408709399071.67802@vitec.com> Message-ID: Use av_log_set_level( AV_LOG_DEBUG ) when you initialize libs. You can set any needed level via av_log_set_level() 2014-08-22 16:20 GMT+04:00 Tilak Varisetty : > I think the flags AV_LOG_DEBUG, AV_LOG_ERROR are enabled based on the > importance level of the logged function av_log(). > > To log all the info you can use av_log(NULL, AV_LOG_INFO, "Message to be > displayed"); > > I am not sure if you wanted to know the above information. > > Regards, > Tilak. > > > On Fri, Aug 22, 2014 at 2:09 PM, Nicolas Derouineau < > nicolas.derouineau at vitec.com> wrote: > >> Hello, >> >> I'm currently playing with libavcodec as a static library, and I would >> like to get the debug message (printed by the following) >> >> av_log(h->avctx, AV_LOG_DEBUG, >> "NAL_IDR Detected\n"); >> >> Only the message printed with >> >> av_log(h->avctx, AV_LOG_ERROR, >> "NAL_IDR Detected\n"); >> >> are currently displayed. Does anyone know how to activate this ? I see a >> DEBUGLEVEL option in the configure script, but no further description is >> given. >> >> Regards, >> >> Nicolas >> >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sat Aug 23 17:30:07 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sat, 23 Aug 2014 19:30:07 +0400 Subject: [Libav-user] ffmpeg with Android In-Reply-To: References: Message-ID: I tried this function several deys ago on android, I work for project where I need to play rtp h263/h264 stream. In my case this function doesn't work because I can't detect video size (on android only, it works on linux). When I set video size by myself I can't read frames because av_read_frame doesn't work as expected, I have no time for investigations and I did the ptoject via gstreamer. You can set av_log_set_level( AV_LOG_DEBUG ); and see libav messages. 2014-08-20 16:38 GMT+04:00 Swapnil Bhoite : > Hi, > > I am working on Android (Compiled ffmpeg-2.3.3 for Android on Ubuntu > 12.04). > The basic purpose of my project is open and play HLS. > I've been searching on internet for doing so, but I'm unable to find > useful guidance. > Looking forward for further guidance. > > From examples, I have created one to get metadata of file. It is working > fine for local file but avformat_open_input(...) returning -5(I/O error) > if online URL is passed as input file name. > > Thank you, > -Swapnil > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Sat Aug 23 17:38:42 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sat, 23 Aug 2014 19:38:42 +0400 Subject: [Libav-user] LIBAV RTP - capability for packet loss concealment! In-Reply-To: References: Message-ID: I think easy way is using rtcp for counting of packet loss. Please see here the example with rtcp 2014-08-16 18:05 GMT+04:00 Sam William : > Hello, > We are using libav's RTP networking stack for low-latency > video-conferencing.. > > We need to add the capability for packet loss concealment into the libav > RTP stack Through API or OpenSource.. whichever is best solution? > > Or how we can use the RTP sequence number to measure the packet loss in a > vbr setting in which buffering is required? > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From mkaroshi at yahoo.com Sat Aug 23 01:46:08 2014 From: mkaroshi at yahoo.com (mahesh) Date: Fri, 22 Aug 2014 16:46:08 -0700 (PDT) Subject: [Libav-user] swr_convert questions In-Reply-To: References: Message-ID: <1408751168184-4660322.post@n4.nabble.com> I had the same issue with swr_convert, i used the different library soxr for just resampling. Then I added a fifo to feed the resampled output to encoder. You need to remember the encoder frame->nb_samples is 1024. So to feed your resampled data to encoder the frame sample should be 1024. When you resample, you dont get always 1024 samples. So you need to save your data until you get 1024 samples. When you get 1024 samples, you feed to the encoder. Again 1 sample is 4 bytes for aac codec. So your total memory size should be greater than 4096 bytes. http://sourceforge.net/p/soxr/wiki/Home/ My audio quality is awsome, after doing all this. I have issues video and audio synching right now. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-swr-convert-questions-tp4660132p4660322.html Sent from the libav-users mailing list archive at Nabble.com. From adjiev.dmitry at gmail.com Sun Aug 24 00:10:54 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Sun, 24 Aug 2014 02:10:54 +0400 Subject: [Libav-user] rtcp in multicasting In-Reply-To: References: Message-ID: Ah! rtcp can't fix this because if some clients shows video, hence multicast delivered it correctly!!! Seems issue in client .. Thank you. 2014-08-23 19:04 GMT+04:00 Dmitry Adjiev : > Thanks for your reply. > Project works on android. > 40 clients should work with server, but when we connect 15 first 3-5 > devices don't show video, they like hang (stop play video). > What should I do for fixing this? Will rtcp fix this? > > > > 2014-08-23 3:06 GMT+04:00 Anthony Clark : > > Dmitry, >> >> The point of RTCP is to provide feedback from each connected >> client/receiver. This would not make sense to be multicast. Though, if your >> talking about the RTP server, then that might depend on the spec... It's >> all in the RFC of course. >> >> -AC >> >> >> On Aug 21, 2014, at 10:49 PM, Dmitry Adjiev >> wrote: >> >> > Hello. >> > I have one question: should I send rtcp to multicast group? >> > -- >> > Regards, >> > Dmitry >> > _______________________________________________ >> > Libav-user mailing list >> > Libav-user at ffmpeg.org >> > http://ffmpeg.org/mailman/listinfo/libav-user >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sun Aug 24 00:49:04 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 23 Aug 2014 22:49:04 +0000 (UTC) Subject: [Libav-user] Could not find codec parameters for stream 0 (Video: h263, yuv420p): unspecified size References: Message-ID: Dmitry Adjiev writes: > I tested it with ffplay under linux, but not under android. Is there a reason that you didn't test with ffmpeg (not ffplay) under Android? Were you maybe using unusual configure options? Please do not top-post on this mailing list, Carl Eugen From hector.alonso.aparicio at gmail.com Mon Aug 25 15:23:20 2014 From: hector.alonso.aparicio at gmail.com (Hector Alonso) Date: Mon, 25 Aug 2014 15:23:20 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API In-Reply-To: References: Message-ID: Hi, I've rebuilt ffmpeg using these instructions https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC from the Visual Studio Console, installing MinGW directly from the link with the flags --enable-dxva2 and --enable-hwaccel=h264_dxva2 and is almost working but I get a lot of errors: -1094995529 "Invalid data found when processing input" from avcodec_decode_video2 a lot of artifacts and a very poor and inconsistent image quality. This is my dxva initialization code: _pCodecCtx->flags|= CODEC_CAP_DR1; _pCodecCtx->flags|= CODEC_CAP_HWACCEL; InputStream *ist = new InputStream (); ist->hwaccel_id = HWACCEL_AUTO; ist->hwaccel_device = "dxva2"; ist->dec = _pCodec; ist->dec_ctx = _pCodecCtx; _pCodecCtx->coded_width = 1280; _pCodecCtx->coded_height = 720; _pCodecCtx->opaque = ist; dxva2_init(_pCodecCtx); _pCodecCtx->opaque = ist; _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; _pCodecCtx->get_format = get_format; _pCodecCtx->thread_safe_callbacks = 0; before calling if (avcodec_open2(_pCodecCtx , _pCodec, 0) < 0) ... Where get_format is: static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) { InputStream* ist = (InputStream*)s->opaque; ist->active_hwaccel_id = HWACCEL_DXVA2; ist->hwaccel_pix_fmt = AV_PIX_FMT_DXVA2_VLD; return ist->hwaccel_pix_fmt; } Find attached my modified ffmpeg_dxva2.cpp and ffmpeg_dxva2.h files from the original ffmpeg_dxva2.c and the InputStream declaration from ffmpeg.h For getting the decoded frame I call: dxva2_retrieve_data_call, and then I convert it to YUV420p (I make the final conversion via pixel shader with OpenGL texture). Also, with my old CPU decoder I had 3-6% CPU usage and 5-10% GPU usage (as I said, I'm converting and painting with OpenGL) and now with the "GPU Accelerated" one I have 5-13% CPU and 6-12% GPU. Any thoughts? Thank you! 2014-08-19 11:25 GMT+02:00 Hector Alonso : > Hi, > I'm developing a H264 decoder in Windows and I want to use the hardware > acceleration capabilities: DXVA2 > I've already built FFMPEG from git (lastest version: N-65404-gd34ec64; > libavcodec 55.73.101 ...) using Mingw64 for 32bits this way: > > > echo 'export PATH=.:/local/bin:/bin:/mingw64/bin' > .profile > source .profile > > > git config --global core.autocrlf false > git clone git://git.videolan.org/x264.git x264 cd x264 ./configure > --host=x86_64-w64-mingw32 --enable-static --enable-shared && make && make > install cd .. git clone git://github.com/mstorsjo/fdk-aac.git fdk-aac cd > fdk-aac ./autogen.sh ./configure --host=x86_64-w64-mingw32 --enable-static > --enable-shared && make && make install cd .. > > git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg cd ffmpeg > ./configure --enable-gpl --enable-nonfree --enable-libx264 > --enable-libfdk_aac --enable-memalign-hack --enable-runtime-cpudetect > --enable-dxva2 --enable-decoder?h264_dxva2 --disable-hwaccels > --enable-hwaccel=h264_dxva2 --enable-static --enable-shared > --extra-cflags=-I/local/include --extra-ldflags='-L/local/lib -static' && > make && make install > > I've adapted the newest version of ffmpeg_dxva2.c to C++ (with a header > file including InputStream, HWAccelID and dxva2_init declarations), now > it builds with VisualStudio 2012 and everything is running correctly with > my current decoder (not HW accelerated). > > I found an old post of this list ( > https://lists.ffmpeg.org/pipermail/ffmpeg-user/2012-May/006600.html) > describing the steps for running it, but now te API has changed... > I've also studied the VLC method, but it is also working with the older > API (get_buffer instead of get_buffer2, and so). > In the newest ffmpeg.c they actually use the hwaccel including DXVA2, but > in quite a complicated way... could you please give an example or a piece > of advice on how to do it? > > 1.- Create a InputStream instance, populate it and address it to > AVCodecContext->opaque. Which are the needed attributes? It requires width > and height of the input before opening it! > > 2.- call dxva_init() with the decoder AVCodecContext allocated using > avcodec_alloc_context3 from CODEC_ID_H264 codec before > calling avcodec_open2 ? > > 3.- Call dxva2_retrieve_data() with the decoder AVCodecContext and a AV_PIX_FMT_NV12 > frame when avcodec_decode_video2 returns a complete frame (got_output) ? > > 4.- Copy (convert) the resulting frame to a YUV420P OpenGL texture, apply > a pixelformat conversion shader and show it! <- This step is working fine > (I did it for a separated decoder using Intel Media SDK last week). > > (Future step. - use directly the DX surface using OpenGL extensions.) > > Now I'm stuck in the first and second steps, when avcodec_decode_video2 > is called it crashes. I've debugged step by step the dxva initialization > and the DX surfaces are being created correctly. What am I missing? > > Thanks! > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ffmpeg_dxva2.cpp Type: text/x-c++src Size: 21815 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ffmpeg_dxva2.h Type: text/x-chdr Size: 3525 bytes Desc: not available URL: From nfxjfg at googlemail.com Mon Aug 25 17:37:27 2014 From: nfxjfg at googlemail.com (wm4) Date: Mon, 25 Aug 2014 17:37:27 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API In-Reply-To: References: Message-ID: <20140825173727.2db17e04@debian> On Mon, 25 Aug 2014 15:23:20 +0200 Hector Alonso wrote: > Hi, > I've rebuilt ffmpeg using these instructions > https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC from the Visual Studio > Console, installing MinGW directly from the link with the flags --enable-dxva2 > and --enable-hwaccel=h264_dxva2 and is almost working but I get a lot > of errors: > -1094995529 "Invalid data found when processing input" > from avcodec_decode_video2 a lot of artifacts and a very poor and > inconsistent image quality. > This is my dxva initialization code: > > _pCodecCtx->flags|= CODEC_CAP_DR1; > _pCodecCtx->flags|= CODEC_CAP_HWACCEL; Uh, no. The user isn't supposed to set these. > InputStream *ist = new InputStream (); > ist->hwaccel_id = HWACCEL_AUTO; > ist->hwaccel_device = "dxva2"; > ist->dec = _pCodec; > ist->dec_ctx = _pCodecCtx; > _pCodecCtx->coded_width = 1280; > _pCodecCtx->coded_height = 720; > _pCodecCtx->opaque = ist; > dxva2_init(_pCodecCtx); > _pCodecCtx->opaque = ist; > _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; > _pCodecCtx->get_format = get_format; > _pCodecCtx->thread_safe_callbacks = 0; Looking at this, you probably forgot to set the extradata? > before calling > > if (avcodec_open2(_pCodecCtx , _pCodec, 0) < 0) ... > > Where get_format is: > > static enum AVPixelFormat get_format(AVCodecContext *s, const enum > AVPixelFormat *pix_fmts) > { > InputStream* ist = (InputStream*)s->opaque; > ist->active_hwaccel_id = HWACCEL_DXVA2; > ist->hwaccel_pix_fmt = AV_PIX_FMT_DXVA2_VLD; > return ist->hwaccel_pix_fmt; > } > > Find attached my modified ffmpeg_dxva2.cpp and ffmpeg_dxva2.h files from > the original ffmpeg_dxva2.c and the InputStream declaration from ffmpeg.h > > For getting the decoded frame I call: dxva2_retrieve_data_call, and then I > convert it to YUV420p (I make the final conversion via pixel shader with > OpenGL texture). > > Also, with my old CPU decoder I had 3-6% CPU usage and 5-10% GPU usage (as > I said, I'm converting and painting with OpenGL) and now with the "GPU > Accelerated" one I have 5-13% CPU and 6-12% GPU. > > Any thoughts? > > Thank you! What would be interesting to know is if there's a direct way to use a dxva surface in OpenGL. This would avoid the potentially slow copy. Well, probably not... From nfxjfg at googlemail.com Mon Aug 25 17:53:54 2014 From: nfxjfg at googlemail.com (wm4) Date: Mon, 25 Aug 2014 17:53:54 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API In-Reply-To: References: Message-ID: <20140825175354.25e17a05@debian> On Mon, 25 Aug 2014 15:23:20 +0200 Hector Alonso wrote: > Hi, > I've rebuilt ffmpeg using these instructions > https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC from the Visual Studio > Console, installing MinGW directly from the link with the flags --enable-dxva2 > and --enable-hwaccel=h264_dxva2 and is almost working but I get a lot > of errors: > -1094995529 "Invalid data found when processing input" > from avcodec_decode_video2 a lot of artifacts and a very poor and > inconsistent image quality. > This is my dxva initialization code: > > _pCodecCtx->flags|= CODEC_CAP_DR1; > _pCodecCtx->flags|= CODEC_CAP_HWACCEL; > > InputStream *ist = new InputStream (); > ist->hwaccel_id = HWACCEL_AUTO; > ist->hwaccel_device = "dxva2"; > ist->dec = _pCodec; > ist->dec_ctx = _pCodecCtx; > _pCodecCtx->coded_width = 1280; > _pCodecCtx->coded_height = 720; > _pCodecCtx->opaque = ist; > dxva2_init(_pCodecCtx); > _pCodecCtx->opaque = ist; > _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; > _pCodecCtx->get_format = get_format; > _pCodecCtx->thread_safe_callbacks = 0; > > before calling > > if (avcodec_open2(_pCodecCtx , _pCodec, 0) < 0) ... > > Where get_format is: > > static enum AVPixelFormat get_format(AVCodecContext *s, const enum > AVPixelFormat *pix_fmts) > { > InputStream* ist = (InputStream*)s->opaque; > ist->active_hwaccel_id = HWACCEL_DXVA2; > ist->hwaccel_pix_fmt = AV_PIX_FMT_DXVA2_VLD; > return ist->hwaccel_pix_fmt; > } > > Find attached my modified ffmpeg_dxva2.cpp and ffmpeg_dxva2.h files from > the original ffmpeg_dxva2.c and the InputStream declaration from ffmpeg.h > > For getting the decoded frame I call: dxva2_retrieve_data_call, and then I > convert it to YUV420p (I make the final conversion via pixel shader with > OpenGL texture). > > Also, with my old CPU decoder I had 3-6% CPU usage and 5-10% GPU usage (as > I said, I'm converting and painting with OpenGL) and now with the "GPU > Accelerated" one I have 5-13% CPU and 6-12% GPU. PS: nevcairiel mentioned: http://developer.download.nvidia.com/opengl/specs/WGL_NV_DX_interop.txt Unfortunately, it's marked as experimental, and other drivers probably don't provide it. > Any thoughts? > > Thank you! > From adjiev.dmitry at gmail.com Mon Aug 25 21:14:27 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Mon, 25 Aug 2014 23:14:27 +0400 Subject: [Libav-user] Could not find codec parameters for stream 0 (Video: h263, yuv420p): unspecified size In-Reply-To: References: Message-ID: 2014-08-24 2:49 GMT+04:00 Carl Eugen Hoyos : > Dmitry Adjiev writes: > > I tested it with ffplay under linux, but not under android. > On android I tested existing ffmpeg builds, they don't work. > > Is there a reason that you didn't test with ffmpeg (not > ffplay) under Android? > I didn't test my builds because I have no rooted device, I have perm > denied error. > Were you maybe using unusual configure options? > > Please do not top-post on this mailing list, Carl Eugen > at least it's --enable-gpl --enable-version3 --enable-h264 --enable-nonfree > This build fors fine under linux, I checked it and started development. I work for video multicast client/server app, server developed by me is works for now, but client doesn't. I'll try disable --enable-nonfree and update you. I need only H263 OR H264 > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > I tested ffplay on linux, ffmpeg shows correct stream info on linux. Existing ffmpeg builds for android can't play the stream, my ffmpeg build I can't run -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Mon Aug 25 21:30:48 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Mon, 25 Aug 2014 23:30:48 +0400 Subject: [Libav-user] Could not find codec parameters for stream 0 (Video: h263, yuv420p): unspecified size In-Reply-To: References: Message-ID: 2014-08-25 23:14 GMT+04:00 Dmitry Adjiev : > > 2014-08-24 2:49 GMT+04:00 Carl Eugen Hoyos : > >> Dmitry Adjiev writes: >> >> I tested it with ffplay under linux, but not under android. >> > On android I tested existing ffmpeg builds, they don't work. > >> >> Is there a reason that you didn't test with ffmpeg (not >> ffplay) under Android? >> I didn't test my builds because I have no rooted device, I have perm >> denied error. >> >> Were you maybe using unusual configure options? >> > > >> Please do not top-post on this mailing list, Carl Eugen >> at least it's --enable-gpl --enable-version3 --enable-h264 >> --enable-nonfree >> > This build fors fine under linux, I checked it and started development. > I work for video multicast client/server app, server developed by me > is works for now, but client doesn't. > I'll try disable --enable-nonfree and update you. I need only H263 OR > H264 > >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > I tested ffplay on linux, ffmpeg shows correct stream info on linux. > Existing ffmpeg builds for android can't play the stream, my ffmpeg build > I can't run > -- > Regards, > Dmitry > Here is my current script for building: #!/bin/bash NDK=/home/dmitry/etc/android/android-ndk-r9d SYSROOT=$NDK/platforms/android-14/arch-arm TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64 function build_one { ./configure \ --prefix=$PREFIX \ --disable-shared \ --enable-static \ --disable-doc \ --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \ --enable-nonfree \ --target-os=linux \ --arch=arm \ --enable-cross-compile \ --sysroot=$SYSROOT \ --extra-cflags="-Os -fpic $ADDI_CFLAGS" \ --extra-ldflags="$ADDI_LDFLAGS" \ --sysinclude=$NDK/home/dmitry/etc/android/android-ndk-r9/platforms/android-14/arch-arm/usr/include\ $ADDITIONAL_CONFIGURE_FLAG make clean /home/dmitry/etc/android/android-ndk-r9d/ndk-build } CPU=arm PREFIX=$(pwd)/android/$CPU ADDI_CFLAGS="-marm" NDK_PROJECT_PATH=/home/dmitry/etc/src/ffmpeg-2.3/android/arm build_one -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From hector.alonso.aparicio at gmail.com Tue Aug 26 10:58:45 2014 From: hector.alonso.aparicio at gmail.com (Hector Alonso) Date: Tue, 26 Aug 2014 10:58:45 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API In-Reply-To: <20140825175354.25e17a05@debian> References: <20140825175354.25e17a05@debian> Message-ID: Hi, I've modified my initialization code: supressed flags, and enabled thread_safe_callbacks, but the result is the same, lots of "Missing reference picture, default is __" error messages and avcodec_decode_video2 returns -1094995529 "Invalid data found when processing input" half the time. The video is showing very very poorly with tons of compression artifacts. I've read the extradata comment in ffmpeg code and it seems that is not really used with H264 codec. I've run my ffmpeg-not-HWaccel decoder and the extradata is not used at all indeed. This is the new initialization: #ifdef DXVA2_DECODER_ENABLED // Create and populate Input Stream structure: InputStream* ist = new InputStream(); ist->hwaccel_id = HWACCEL_AUTO; ist->hwaccel_device = "dxva2"; ist->dec = _pCodec; ist->dec_ctx = _pCodecCtx; // Set Known width and height _pCodecCtx->coded_width = 1280; _pCodecCtx->coded_height = 720; // Set Input Stream structure as ancillary data into codec _pCodecCtx->opaque = ist; // Initialize DXV2 context dxva2_init(_pCodecCtx); // Set DXVA2 callbacks to codec context _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; _pCodecCtx->get_format = get_format; _pCodecCtx->thread_safe_callbacks = 1; #endif Remember: dxva2_init is a call to the analogue method from ffmpeg_dxva.c file modified by me into a .h and a .cpp attached in a previous mail (I don't know if that's a common practice in this mail list or you do it in another way). Regarding the next step (using the DX surface directly as an OpenGL texture), it can be done using: WGLEW_NV_DX_interop, wglDXOpenDeviceNV, wglDXSetResourceShareHandleNV, wglDXRegisterObjectNV, make current, lock, etc. Look at WiDiSample code -> RenderOpenGL.cpp bind texture (Intel Media SDK video decoder example), and this page: http://halogenica.net/sharing-resources-between-directx-and-opengl/ ...but for now I'm more worried about getting the DXVA2 to work properly with FFMPEG. What am I missing? 2014-08-25 17:53 GMT+02:00 wm4 : > On Mon, 25 Aug 2014 15:23:20 +0200 > Hector Alonso wrote: > > > Hi, > > I've rebuilt ffmpeg using these instructions > > https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC from the Visual > Studio > > Console, installing MinGW directly from the link with the flags > --enable-dxva2 > > and --enable-hwaccel=h264_dxva2 and is almost working but I get a lot > > of errors: > > -1094995529 "Invalid data found when processing input" > > from avcodec_decode_video2 a lot of artifacts and a very poor and > > inconsistent image quality. > > This is my dxva initialization code: > > > > _pCodecCtx->flags|= CODEC_CAP_DR1; > > _pCodecCtx->flags|= CODEC_CAP_HWACCEL; > > > > InputStream *ist = new InputStream (); > > ist->hwaccel_id = HWACCEL_AUTO; > > ist->hwaccel_device = "dxva2"; > > ist->dec = _pCodec; > > ist->dec_ctx = _pCodecCtx; > > _pCodecCtx->coded_width = 1280; > > _pCodecCtx->coded_height = 720; > > _pCodecCtx->opaque = ist; > > dxva2_init(_pCodecCtx); > > _pCodecCtx->opaque = ist; > > _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; > > _pCodecCtx->get_format = get_format; > > _pCodecCtx->thread_safe_callbacks = 0; > > > > before calling > > > > if (avcodec_open2(_pCodecCtx , _pCodec, 0) < 0) ... > > > > Where get_format is: > > > > static enum AVPixelFormat get_format(AVCodecContext *s, const enum > > AVPixelFormat *pix_fmts) > > { > > InputStream* ist = (InputStream*)s->opaque; > > ist->active_hwaccel_id = HWACCEL_DXVA2; > > ist->hwaccel_pix_fmt = AV_PIX_FMT_DXVA2_VLD; > > return ist->hwaccel_pix_fmt; > > } > > > > Find attached my modified ffmpeg_dxva2.cpp and ffmpeg_dxva2.h files from > > the original ffmpeg_dxva2.c and the InputStream declaration from ffmpeg.h > > > > For getting the decoded frame I call: dxva2_retrieve_data_call, and then > I > > convert it to YUV420p (I make the final conversion via pixel shader with > > OpenGL texture). > > > > Also, with my old CPU decoder I had 3-6% CPU usage and 5-10% GPU usage > (as > > I said, I'm converting and painting with OpenGL) and now with the "GPU > > Accelerated" one I have 5-13% CPU and 6-12% GPU. > > PS: nevcairiel mentioned: > http://developer.download.nvidia.com/opengl/specs/WGL_NV_DX_interop.txt > > Unfortunately, it's marked as experimental, and other drivers probably > don't provide it. > > > Any thoughts? > > > > Thank you! > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hector.alonso.aparicio at gmail.com Tue Aug 26 16:45:54 2014 From: hector.alonso.aparicio at gmail.com (Hector Alonso) Date: Tue, 26 Aug 2014 16:45:54 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API In-Reply-To: References: <20140825175354.25e17a05@debian> Message-ID: I've changed the size and number of the slices from the source and it shows perfectly the video. What is the relation between the slices and the DXVA2 ? 2014-08-26 10:58 GMT+02:00 Hector Alonso : > Hi, > > I've modified my initialization code: supressed flags, and enabled > thread_safe_callbacks, but the result is the same, lots of "Missing > reference picture, default is __" error messages and avcodec_decode_video2 > returns -1094995529 "Invalid data found when processing input" half the > time. > The video is showing very very poorly with tons of compression artifacts. > I've read the extradata comment in ffmpeg code and it seems that is not > really used with H264 codec. I've run my ffmpeg-not-HWaccel decoder and the > extradata is not used at all indeed. > > This is the new initialization: > > #ifdef DXVA2_DECODER_ENABLED > > // Create and populate Input Stream structure: > InputStream* ist = new InputStream(); > ist->hwaccel_id = HWACCEL_AUTO; > ist->hwaccel_device = "dxva2"; > ist->dec = _pCodec; > ist->dec_ctx = _pCodecCtx; > > // Set Known width and height > _pCodecCtx->coded_width = 1280; > _pCodecCtx->coded_height = 720; > > // Set Input Stream structure as ancillary data into codec > _pCodecCtx->opaque = ist; > // Initialize DXV2 context > dxva2_init(_pCodecCtx); > > // Set DXVA2 callbacks to codec context > _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; > _pCodecCtx->get_format = get_format; > _pCodecCtx->thread_safe_callbacks = 1; > > #endif > > Remember: dxva2_init is a call to the analogue method from ffmpeg_dxva.c > file modified by me into a .h and a .cpp attached in a previous mail (I > don't know if that's a common practice in this mail list or you do it in > another way). > > Regarding the next step (using the DX surface directly as an OpenGL > texture), it can be done > using: WGLEW_NV_DX_interop, wglDXOpenDeviceNV, wglDXSetResourceShareHandleNV, wglDXRegisterObjectNV, > make current, lock, etc. > > Look at WiDiSample code -> RenderOpenGL.cpp bind texture (Intel Media SDK > video decoder example), and this page: > http://halogenica.net/sharing-resources-between-directx-and-opengl/ > > ...but for now I'm more worried about getting the DXVA2 to work properly > with FFMPEG. > > What am I missing? > > > > > 2014-08-25 17:53 GMT+02:00 wm4 : > > On Mon, 25 Aug 2014 15:23:20 +0200 >> Hector Alonso wrote: >> >> > Hi, >> > I've rebuilt ffmpeg using these instructions >> > https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC from the Visual >> Studio >> > Console, installing MinGW directly from the link with the flags >> --enable-dxva2 >> > and --enable-hwaccel=h264_dxva2 and is almost working but I get a lot >> > of errors: >> > -1094995529 "Invalid data found when processing input" >> > from avcodec_decode_video2 a lot of artifacts and a very poor and >> > inconsistent image quality. >> > This is my dxva initialization code: >> > >> > _pCodecCtx->flags|= CODEC_CAP_DR1; >> > _pCodecCtx->flags|= CODEC_CAP_HWACCEL; >> > >> > InputStream *ist = new InputStream (); >> > ist->hwaccel_id = HWACCEL_AUTO; >> > ist->hwaccel_device = "dxva2"; >> > ist->dec = _pCodec; >> > ist->dec_ctx = _pCodecCtx; >> > _pCodecCtx->coded_width = 1280; >> > _pCodecCtx->coded_height = 720; >> > _pCodecCtx->opaque = ist; >> > dxva2_init(_pCodecCtx); >> > _pCodecCtx->opaque = ist; >> > _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; >> > _pCodecCtx->get_format = get_format; >> > _pCodecCtx->thread_safe_callbacks = 0; >> > >> > before calling >> > >> > if (avcodec_open2(_pCodecCtx , _pCodec, 0) < 0) ... >> > >> > Where get_format is: >> > >> > static enum AVPixelFormat get_format(AVCodecContext *s, const enum >> > AVPixelFormat *pix_fmts) >> > { >> > InputStream* ist = (InputStream*)s->opaque; >> > ist->active_hwaccel_id = HWACCEL_DXVA2; >> > ist->hwaccel_pix_fmt = AV_PIX_FMT_DXVA2_VLD; >> > return ist->hwaccel_pix_fmt; >> > } >> > >> > Find attached my modified ffmpeg_dxva2.cpp and ffmpeg_dxva2.h files from >> > the original ffmpeg_dxva2.c and the InputStream declaration from >> ffmpeg.h >> > >> > For getting the decoded frame I call: dxva2_retrieve_data_call, and >> then I >> > convert it to YUV420p (I make the final conversion via pixel shader with >> > OpenGL texture). >> > >> > Also, with my old CPU decoder I had 3-6% CPU usage and 5-10% GPU usage >> (as >> > I said, I'm converting and painting with OpenGL) and now with the "GPU >> > Accelerated" one I have 5-13% CPU and 6-12% GPU. >> >> PS: nevcairiel mentioned: >> http://developer.download.nvidia.com/opengl/specs/WGL_NV_DX_interop.txt >> >> Unfortunately, it's marked as experimental, and other drivers probably >> don't provide it. >> >> > Any thoughts? >> > >> > Thank you! >> > >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From diceydawg at gmail.com Tue Aug 26 19:42:00 2014 From: diceydawg at gmail.com (diceydawg .) Date: Tue, 26 Aug 2014 13:42:00 -0400 Subject: [Libav-user] Detecting bad frames h.264 decoder Message-ID: Hi, i am developing an application that decodes a mpeg-ts file that must drop any frames which may cause video artifacts (for the purpose of machine vision algorithms). Currently I am using the log_callback within a mutex (for multi-threaded decoders) in order to receive the correct error for a given frame. (example below) if (level == AV_LOG_FATAL) { //print out error } else if (level == AV_LOG_ERROR) { /** handle bad frame */ } else { Since parsing the log to detect error's is not the best way to detect frame issues, Is there a better way to handle this? Can I retrieve the error from a frame returned from avcodec_decode_video2? Daisuke -------------- next part -------------- An HTML attachment was scrubbed... URL: From krish.rao.v at gmail.com Wed Aug 27 15:48:14 2014 From: krish.rao.v at gmail.com (Krishna) Date: Wed, 27 Aug 2014 09:48:14 -0400 Subject: [Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream Message-ID: Hi, I am writing an HEVC decoder and it seems that the first several frames are not decoded by avcodec_decode_video2(). Here is my code snippet. The input is an video-only stream (no audio). This is my function, that is called each time I need a single frame (that is essentially what I want -- one frame at a time). bool decode(pFormatCtx, pCodecCtx) { int gotaFrame=0; int retVal = 0; while (gotaFrame==0) { printf("1\t"); if ( !av_read_frame(pFormatCtx, &packet) ) { if(packet.stream_index==videoStreamIndex) { // try decoding retVal = avcodec_decode_video2(pCodecCtx, pFrame, &gotaFrame, &packet); printf("%d\t", retVal); if (gotaFrame) { // decode success. printf("2\t"); // dump to yuv ... not shown here. // cleanup av_frame_unref(pFrame); av_frame_free(&pFrame); av_free_packet(&packet); return true; } } } } } Here is the output of retVal: retval=33149 retval=6715 retval=767 retval=264 retval=126 retval=147 retval=286 retval=140 retval=141 retval=7243 retval=568 retval=315 retval=95 retval=146 retval=328 retval=159 retval=121 retval=7010 retval=571 retval=309 After the retVal=309, gotaFrame becomes 1. Essentially, I have lost a lot of frames. Can someone help me out here? How do I get one frame at a time? Thank you! -------------- next part -------------- An HTML attachment was scrubbed... URL: From amankjan at gmail.com Wed Aug 27 16:05:50 2014 From: amankjan at gmail.com (Atela Wu) Date: Wed, 27 Aug 2014 22:05:50 +0800 Subject: [Libav-user] reconnect after socket timeout Message-ID: hi,guys, i?m trying to reconnect the rtmp live stream connection when socket receives timeout simply likes ffplay ?rtmp://xxxxxx timeout=5? but after av_read_frame receiving timeout, no flag can specify it is eof or timeout, it returns eof all the time, but it?s fine, whatever i reconnect to it. my code is just like this, but after i reopen the io_context, av_read_frame will be stucked ret = av_read_frame(format_ctx, pkt); if (avio_feof(format_ctx->pb)) { avio_close(format_ctx->pb); avio_open(&format_ctx->pb, filename, AVIO_FLAG_READ) ; ic->pb->eof_reached = 0; av_free_packet(pkt); ret = av_read_frame(format_ctx, pkt); } i cannot just call avformat_open_input and avformat_find_stream_info, because of the format_ctx (including AVstreams, CodecContext) had been using in other decoding threads. any suggestions i will appreciate it . thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From markuspfundstein86 at gmail.com Wed Aug 27 19:14:36 2014 From: markuspfundstein86 at gmail.com (Markus Pfundstein) Date: Wed, 27 Aug 2014 19:14:36 +0200 Subject: [Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream In-Reply-To: References: Message-ID: a frame can consist of several packets. thats why you need to call av_decode_video2 multiple times until it has a fully decoded frame for you. the return values tell you how much data was read. you should adjust packet.data and packet.size by those values. there a a lot of examples out there that show this. gr markus -- sent from ipad > On 27 aug. 2014, at 15:48, Krishna wrote: > > Hi, > > I am writing an HEVC decoder and it seems that the first several frames are not decoded by avcodec_decode_video2(). Here is my code snippet. The input is an video-only stream (no audio). This is my function, that is called each time I need a single frame (that is essentially what I want -- one frame at a time). > > bool decode(pFormatCtx, pCodecCtx) > { > int gotaFrame=0; > int retVal = 0; > while (gotaFrame==0) { > > printf("1\t"); > > if ( !av_read_frame(pFormatCtx, &packet) ) { > if(packet.stream_index==videoStreamIndex) { > > // try decoding > retVal = avcodec_decode_video2(pCodecCtx, pFrame, &gotaFrame, &packet); > printf("%d\t", retVal); > > if (gotaFrame) { // decode success. > > printf("2\t"); > > // dump to yuv ... not shown here. > > // cleanup > av_frame_unref(pFrame); > av_frame_free(&pFrame); > av_free_packet(&packet); > > return true; > } > } > } > } > } > > Here is the output of retVal: > > retval=33149 > retval=6715 > retval=767 > retval=264 > retval=126 > retval=147 > retval=286 > retval=140 > retval=141 > retval=7243 > retval=568 > retval=315 > retval=95 > retval=146 > retval=328 > retval=159 > retval=121 > retval=7010 > retval=571 > retval=309 > > After the retVal=309, gotaFrame becomes 1. Essentially, I have lost a lot of frames. Can someone help me out here? > > How do I get one frame at a time? > > Thank you! > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From nfxjfg at googlemail.com Wed Aug 27 23:37:15 2014 From: nfxjfg at googlemail.com (wm4) Date: Wed, 27 Aug 2014 23:37:15 +0200 Subject: [Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream In-Reply-To: References: Message-ID: <20140827233715.57d2e9d5@debian> On Wed, 27 Aug 2014 19:14:36 +0200 Markus Pfundstein wrote: > a frame can consist of several packets. thats why you need to call av_decode_video2 multiple times until it has a fully decoded frame for you. the return values tell you how much data was read. > you should adjust packet.data and packet.size by those values. > > there a a lot of examples out there that show this. In libavcodec/libavformat, a packet consists of exactly one frame (and libavformat goes out of its way to guarantee this). But decoding can incur a delay of several frames. That means, at start of decoding you have to feed the decoder several packets without getting a video frame back, and at end of decoding you need to feed it null packets to get the remaining frames. From markuspfundstein86 at gmail.com Thu Aug 28 00:42:39 2014 From: markuspfundstein86 at gmail.com (Markus Pfundstein) Date: Thu, 28 Aug 2014 00:42:39 +0200 Subject: [Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream In-Reply-To: <20140827233715.57d2e9d5@debian> References: <20140827233715.57d2e9d5@debian> Message-ID: ah thank you. didnt know that one. but makes sense yes. > On 27 aug. 2014, at 23:37, wm4 wrote: > > On Wed, 27 Aug 2014 19:14:36 +0200 > Markus Pfundstein wrote: > >> a frame can consist of several packets. thats why you need to call av_decode_video2 multiple times until it has a fully decoded frame for you. the return values tell you how much data was read. >> you should adjust packet.data and packet.size by those values. >> >> there a a lot of examples out there that show this. > > In libavcodec/libavformat, a packet consists of exactly one frame (and > libavformat goes out of its way to guarantee this). But decoding can > incur a delay of several frames. That means, at start of decoding you > have to feed the decoder several packets without getting a video frame > back, and at end of decoding you need to feed it null packets to get > the remaining frames. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From hector.alonso.aparicio at gmail.com Thu Aug 28 13:20:17 2014 From: hector.alonso.aparicio at gmail.com (Hector Alonso) Date: Thu, 28 Aug 2014 13:20:17 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API In-Reply-To: References: <20140825175354.25e17a05@debian> Message-ID: Is there a limitation into the number of slices the DXVA2 decoder can manage? Is there any way to reconfigure it? I've changed the "MAX_SLICES" definition and rebuilt ffmpeg (as suggested for the mpeg2 decoder) but nothing has changed. If i set the source of the video (1280*720) to make slices smaller than 2000B (8000bps) it makes the mountrous artifacts. Any suggestions? 2014-08-26 16:45 GMT+02:00 Hector Alonso : > I've changed the size and number of the slices from the source and it > shows perfectly the video. > What is the relation between the slices and the DXVA2 ? > > > > > 2014-08-26 10:58 GMT+02:00 Hector Alonso >: > > Hi, >> >> I've modified my initialization code: supressed flags, and enabled >> thread_safe_callbacks, but the result is the same, lots of "Missing >> reference picture, default is __" error messages and avcodec_decode_video2 >> returns -1094995529 "Invalid data found when processing input" half the >> time. >> The video is showing very very poorly with tons of compression artifacts. >> I've read the extradata comment in ffmpeg code and it seems that is not >> really used with H264 codec. I've run my ffmpeg-not-HWaccel decoder and the >> extradata is not used at all indeed. >> >> This is the new initialization: >> >> #ifdef DXVA2_DECODER_ENABLED >> >> // Create and populate Input Stream structure: >> InputStream* ist = new InputStream(); >> ist->hwaccel_id = HWACCEL_AUTO; >> ist->hwaccel_device = "dxva2"; >> ist->dec = _pCodec; >> ist->dec_ctx = _pCodecCtx; >> >> // Set Known width and height >> _pCodecCtx->coded_width = 1280; >> _pCodecCtx->coded_height = 720; >> >> // Set Input Stream structure as ancillary data into codec >> _pCodecCtx->opaque = ist; >> // Initialize DXV2 context >> dxva2_init(_pCodecCtx); >> >> // Set DXVA2 callbacks to codec context >> _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; >> _pCodecCtx->get_format = get_format; >> _pCodecCtx->thread_safe_callbacks = 1; >> >> #endif >> >> Remember: dxva2_init is a call to the analogue method from ffmpeg_dxva.c >> file modified by me into a .h and a .cpp attached in a previous mail (I >> don't know if that's a common practice in this mail list or you do it in >> another way). >> >> Regarding the next step (using the DX surface directly as an OpenGL >> texture), it can be done >> using: WGLEW_NV_DX_interop, wglDXOpenDeviceNV, wglDXSetResourceShareHandleNV, wglDXRegisterObjectNV, >> make current, lock, etc. >> >> Look at WiDiSample code -> RenderOpenGL.cpp bind texture (Intel Media SDK >> video decoder example), and this page: >> http://halogenica.net/sharing-resources-between-directx-and-opengl/ >> >> ...but for now I'm more worried about getting the DXVA2 to work properly >> with FFMPEG. >> >> What am I missing? >> >> >> >> >> 2014-08-25 17:53 GMT+02:00 wm4 : >> >> On Mon, 25 Aug 2014 15:23:20 +0200 >>> Hector Alonso wrote: >>> >>> > Hi, >>> > I've rebuilt ffmpeg using these instructions >>> > https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC from the Visual >>> Studio >>> > Console, installing MinGW directly from the link with the flags >>> --enable-dxva2 >>> > and --enable-hwaccel=h264_dxva2 and is almost working but I get a lot >>> > of errors: >>> > -1094995529 "Invalid data found when processing input" >>> > from avcodec_decode_video2 a lot of artifacts and a very poor and >>> > inconsistent image quality. >>> > This is my dxva initialization code: >>> > >>> > _pCodecCtx->flags|= CODEC_CAP_DR1; >>> > _pCodecCtx->flags|= CODEC_CAP_HWACCEL; >>> > >>> > InputStream *ist = new InputStream (); >>> > ist->hwaccel_id = HWACCEL_AUTO; >>> > ist->hwaccel_device = "dxva2"; >>> > ist->dec = _pCodec; >>> > ist->dec_ctx = _pCodecCtx; >>> > _pCodecCtx->coded_width = 1280; >>> > _pCodecCtx->coded_height = 720; >>> > _pCodecCtx->opaque = ist; >>> > dxva2_init(_pCodecCtx); >>> > _pCodecCtx->opaque = ist; >>> > _pCodecCtx->get_buffer2 = ist->hwaccel_get_buffer; >>> > _pCodecCtx->get_format = get_format; >>> > _pCodecCtx->thread_safe_callbacks = 0; >>> > >>> > before calling >>> > >>> > if (avcodec_open2(_pCodecCtx , _pCodec, 0) < 0) ... >>> > >>> > Where get_format is: >>> > >>> > static enum AVPixelFormat get_format(AVCodecContext *s, const enum >>> > AVPixelFormat *pix_fmts) >>> > { >>> > InputStream* ist = (InputStream*)s->opaque; >>> > ist->active_hwaccel_id = HWACCEL_DXVA2; >>> > ist->hwaccel_pix_fmt = AV_PIX_FMT_DXVA2_VLD; >>> > return ist->hwaccel_pix_fmt; >>> > } >>> > >>> > Find attached my modified ffmpeg_dxva2.cpp and ffmpeg_dxva2.h files >>> from >>> > the original ffmpeg_dxva2.c and the InputStream declaration from >>> ffmpeg.h >>> > >>> > For getting the decoded frame I call: dxva2_retrieve_data_call, and >>> then I >>> > convert it to YUV420p (I make the final conversion via pixel shader >>> with >>> > OpenGL texture). >>> > >>> > Also, with my old CPU decoder I had 3-6% CPU usage and 5-10% GPU usage >>> (as >>> > I said, I'm converting and painting with OpenGL) and now with the "GPU >>> > Accelerated" one I have 5-13% CPU and 6-12% GPU. >>> >>> PS: nevcairiel mentioned: >>> http://developer.download.nvidia.com/opengl/specs/WGL_NV_DX_interop.txt >>> >>> Unfortunately, it's marked as experimental, and other drivers probably >>> don't provide it. >>> >>> > Any thoughts? >>> > >>> > Thank you! >>> > >>> _______________________________________________ >>> Libav-user mailing list >>> Libav-user at ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/libav-user >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.leppkes at gmail.com Thu Aug 28 13:29:28 2014 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Thu, 28 Aug 2014 13:29:28 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API In-Reply-To: References: <20140825175354.25e17a05@debian> Message-ID: On Thu, Aug 28, 2014 at 1:20 PM, Hector Alonso wrote: > Is there a limitation into the number of slices the DXVA2 decoder can > manage? Is there any way to reconfigure it? > I've changed the "MAX_SLICES" definition and rebuilt ffmpeg (as suggested > for the mpeg2 decoder) but nothing has changed. If i set the source of the > video (1280*720) to make slices smaller than 2000B (8000bps) it makes the > mountrous artifacts. > Any suggestions? > The DXVA2 decoder is limited to 16 slices by default. You can change this variable in libavcodec/h264.h, set MAX_SLICES to something higher. - Hendrik From hector.alonso.aparicio at gmail.com Thu Aug 28 14:21:01 2014 From: hector.alonso.aparicio at gmail.com (Hector Alonso) Date: Thu, 28 Aug 2014 14:21:01 +0200 Subject: [Libav-user] HW Accelerator in Windows: DXVA2 with new API In-Reply-To: References: <20140825175354.25e17a05@debian> Message-ID: 2014-08-28 13:29 GMT+02:00 Hendrik Leppkes : > > The DXVA2 decoder is limited to 16 slices by default. > You can change this variable in libavcodec/h264.h, set MAX_SLICES to > something higher. > > As I did, but in effect if I have more than 4 slices it doesn't decode the key frames! avcodec_decode_video2 returns -1094995529 "Invalid data found when processing input" and there's a lot of "Missing reference picture, default is __" error messages. > - Hendrik > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vtilakece at gmail.com Thu Aug 28 09:33:20 2014 From: vtilakece at gmail.com (Tilak Varisetty) Date: Thu, 28 Aug 2014 09:33:20 +0200 Subject: [Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream In-Reply-To: References: <20140827233715.57d2e9d5@debian> Message-ID: Hello all, I am following a discussion about the decoding delays. I am working with optimizing the delays for our rendering app from ffserver to the webclient using webm container format. I experience a latency of about 300 to 400 msec from the app via ffm, matroskaenc to the browser via websockets. Most part of the delay is due to the decoding part of ffmdec; reading the frame from the ffserver main loop. Changing the FFM_PACKET_SIZE to a higher value does not help. If anyone has an idea to deal with this, it is highly appreciated! Thanks, Tilak. On Thu, Aug 28, 2014 at 12:42 AM, Markus Pfundstein < markuspfundstein86 at gmail.com> wrote: > ah thank you. didnt know that one. but makes sense yes. > > > On 27 aug. 2014, at 23:37, wm4 wrote: > > > > On Wed, 27 Aug 2014 19:14:36 +0200 > > Markus Pfundstein wrote: > > > >> a frame can consist of several packets. thats why you need to call > av_decode_video2 multiple times until it has a fully decoded frame for you. > the return values tell you how much data was read. > >> you should adjust packet.data and packet.size by those values. > >> > >> there a a lot of examples out there that show this. > > > > In libavcodec/libavformat, a packet consists of exactly one frame (and > > libavformat goes out of its way to guarantee this). But decoding can > > incur a delay of several frames. That means, at start of decoding you > > have to feed the decoder several packets without getting a video frame > > back, and at end of decoding you need to feed it null packets to get > > the remaining frames. > > _______________________________________________ > > Libav-user mailing list > > Libav-user at ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/libav-user > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From krish.rao.v at gmail.com Thu Aug 28 22:42:50 2014 From: krish.rao.v at gmail.com (Krishna) Date: Thu, 28 Aug 2014 16:42:50 -0400 Subject: [Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream In-Reply-To: References: <20140827233715.57d2e9d5@debian> Message-ID: Thanks Markus and wm4. I gave your suggestion a shot and this is what I did. In my situation, I call the decoder() and expect a frame. However, the decoder will buffer several packets right in the beginning. Since I need a single frame per call, I now keep track of the number of times it read packets without decoding (in the beginning). I call this "numInitPackets". In the end I flush out that many packets using a null packet. And it worked! Thank you so much for your help! ah thank you. didnt know that one. but makes sense yes. > On 27 aug. 2014, at 23:37, wm4 wrote: > > On Wed, 27 Aug 2014 19:14:36 +0200 > Markus Pfundstein wrote: > >> a frame can consist of several packets. thats why you need to call av_decode_video2 multiple times until it has a fully decoded frame for you. the return values tell you how much data was read. >> you should adjust packet.data and packet.size by those values. >> >> there a a lot of examples out there that show this. > > In libavcodec/libavformat, a packet consists of exactly one frame (and > libavformat goes out of its way to guarantee this). But decoding can > incur a delay of several frames. That means, at start of decoding you > have to feed the decoder several packets without getting a video frame > back, and at end of decoding you need to feed it null packets to get > the remaining frames. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From adjiev.dmitry at gmail.com Thu Aug 28 23:01:30 2014 From: adjiev.dmitry at gmail.com (Dmitry Adjiev) Date: Fri, 29 Aug 2014 01:01:30 +0400 Subject: [Libav-user] rtcp doesn't work in rtp muxer In-Reply-To: References: Message-ID: Issue is fixed, it was my mistake, I sent frames to quicly 2014-08-14 15:14 GMT+04:00 Dmitry Adjiev : > Hello. > I use rtp muxer for streaming video, but ffplay loses a lot of packets. > > in rtpenc.c I see the following code: > > if ((s->first_packet || ((rtcp_bytes >= RTCP_SR_SIZE) && > (ff_ntp_time() - s->last_rtcp_ntp_time > > 5000000))) && > !(s->flags & FF_RTP_FLAG_SKIP_RTCP)) { > av_log(NULL, AV_LOG_INFO, "Send rtcp packet\n"); > rtcp_send_sr(s1, ff_ntp_time(), 0); > s->last_octet_count = s->octet_count; > s->first_packet = 0; > } > > value 5000000 seems too large ... > What I do wrong? > Also what port libavformat uses for rtcp, I think it should be > multicast_ip:multicast_port + 1 right? > -- > Regards, > Dmitry > -- Regards, Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From emptystate at yahoo.co.uk Fri Aug 29 08:35:35 2014 From: emptystate at yahoo.co.uk (Lyndon Hill) Date: Fri, 29 Aug 2014 07:35:35 +0100 Subject: [Libav-user] Rewind file to start Message-ID: <1409294135.12545.YahooMailNeo@web172602.mail.ir2.yahoo.com> Hi, What is the best (most universal) way to rewind a file to the start ? Currently I am using av_seek_frame(formatContext, videoStream, 0, AVSEEK_FLAG_ANY); However, in an HEVC bit stream, there are no timestamps (as interpreted by x265) so this method will not work. Thanks in advance From nfxjfg at googlemail.com Fri Aug 29 14:19:57 2014 From: nfxjfg at googlemail.com (wm4) Date: Fri, 29 Aug 2014 14:19:57 +0200 Subject: [Libav-user] Problem using avcodec_decode_video2 for reading HEVC stream In-Reply-To: References: <20140827233715.57d2e9d5@debian> Message-ID: <20140829141957.44f00022@debian> On Thu, 28 Aug 2014 16:42:50 -0400 Krishna wrote: > Thanks Markus and wm4. I gave your suggestion a shot and this is what I > did. In my situation, I call the decoder() and expect a frame. However, the > decoder will buffer several packets right in the beginning. Since I need a > single frame per call, I now keep track of the number of times it read > packets without decoding (in the beginning). I call this "numInitPackets". > > In the end I flush out that many packets using a null packet. And it > worked! Thank you so much for your help! > ah thank you. didnt know that one. but makes sense yes. You don't need a counter. Once you have no more packets, you start feeding the decoder null packets. And once the decoder doesn't return a new picture, even though you fed it a null packet, you know there are no more frames in the decoder. From d3ck0r at gmail.com Fri Aug 29 18:44:14 2014 From: d3ck0r at gmail.com (J Decker) Date: Fri, 29 Aug 2014 09:44:14 -0700 Subject: [Libav-user] Rewind file to start In-Reply-To: <1409294135.12545.YahooMailNeo@web172602.mail.ir2.yahoo.com> References: <1409294135.12545.YahooMailNeo@web172602.mail.ir2.yahoo.com> Message-ID: You also need to flush the codec contexts. av_flush_buffer http://comments.gmane.org/gmane.comp.video.ffmpeg.devel/17549 also you probably need SEEK_BACKWARD ... I found that seek( 0, SEEK_ANY ) would skip the first keyframe There is also av_seek_file() On Thu, Aug 28, 2014 at 11:35 PM, Lyndon Hill < emptystate-at-yahoo.co.uk at ffmpeg.org> wrote: > Hi, > > What is the best (most universal) way to rewind a file to the start ? > > Currently I am using > > av_seek_frame(formatContext, videoStream, 0, AVSEEK_FLAG_ANY); > > > However, in an HEVC bit stream, there are no timestamps (as interpreted by > x265) so this method will not work. > > Thanks in advance > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From emptystate at yahoo.co.uk Fri Aug 29 22:42:10 2014 From: emptystate at yahoo.co.uk (Lyndon Hill) Date: Fri, 29 Aug 2014 21:42:10 +0100 Subject: [Libav-user] Rewind file to start Message-ID: <1409344930.21008.YahooMailNeo@web172606.mail.ir2.yahoo.com> J Decker d3ck0r at gmail.com wrote: > You also need to flush the codec contexts. > av_flush_buffer > http://comments.gmane.org/gmane.comp.video.ffmpeg.devel/17549 > > also you probably need SEEK_BACKWARD ... I found that seek( 0, SEEK_ANY ) > would skip the first keyframe I tried changing to backward but the problem remains, HEVC bitstreams don't have timestamps; so default timestamp is AV_NOPTS_VALUE which on my system is negative - seeking to timestamp 0 takes you to the end of the file. > There is also av_seek_file() Do you mean avformat_seek_file() ? It also uses timestamps and has a warning in the documentation to not use it. Sorry all if threading is broken; I have been browsing the archives rather than receiving the list and there is no option to receive only replies to your own posts. So I can't post this as a proper reply. I am now setting to receive the list when I post anything. From nfxjfg at googlemail.com Fri Aug 29 22:59:54 2014 From: nfxjfg at googlemail.com (wm4) Date: Fri, 29 Aug 2014 22:59:54 +0200 Subject: [Libav-user] Rewind file to start In-Reply-To: <1409344930.21008.YahooMailNeo@web172606.mail.ir2.yahoo.com> References: <1409344930.21008.YahooMailNeo@web172606.mail.ir2.yahoo.com> Message-ID: <20140829225954.56432f62@debian> On Fri, 29 Aug 2014 21:42:10 +0100 Lyndon Hill wrote: > J Decker d3ck0r at gmail.com wrote: > > > You also need to flush the codec contexts. > > av_flush_buffer > > http://comments.gmane.org/gmane.comp.video.ffmpeg.devel/17549 > > > > also you probably need SEEK_BACKWARD ... I found that seek( 0, SEEK_ANY ) > > would skip the first keyframe > > > I tried changing to backward but the problem remains, HEVC bitstreams don't have timestamps; so default timestamp is AV_NOPTS_VALUE which on my system is negative - seeking to timestamp 0 takes you to the end of the file. > > > > There is also av_seek_file() > > Do you mean avformat_seek_file() ? > It also uses timestamps and has a warning in the documentation to not use it. > > > Sorry all if threading is broken; I have been browsing the archives rather than receiving the list and there is no option to receive only replies to your own posts. So I can't post this as a proper reply. I am now setting to receive the list when I post anything. > For such files, doing byte based seeks is probably the only thing that works. From emptystate at yahoo.co.uk Fri Aug 29 23:40:43 2014 From: emptystate at yahoo.co.uk (Lyndon Hill) Date: Fri, 29 Aug 2014 22:40:43 +0100 Subject: [Libav-user] Rewind file to start In-Reply-To: <20140829225954.56432f62@debian> References: <1409344930.21008.YahooMailNeo@web172606.mail.ir2.yahoo.com> <20140829225954.56432f62@debian> Message-ID: <1409348443.77207.YahooMailNeo@web172606.mail.ir2.yahoo.com> On Friday, 29 August 2014, 21:59, wm4 wrote: > For such files, doing byte based seeks is probably the only thing > that works. Please elaborate. Are you suggesting using the standard C library rewind(FILE *) ? How do you access the file pointer ? Doesn't that break the AVFormatContext ? From d3ck0r at gmail.com Fri Aug 29 23:53:53 2014 From: d3ck0r at gmail.com (J Decker) Date: Fri, 29 Aug 2014 14:53:53 -0700 Subject: [Libav-user] Rewind file to start In-Reply-To: <1409348443.77207.YahooMailNeo@web172606.mail.ir2.yahoo.com> References: <1409344930.21008.YahooMailNeo@web172606.mail.ir2.yahoo.com> <20140829225954.56432f62@debian> <1409348443.77207.YahooMailNeo@web172606.mail.ir2.yahoo.com> Message-ID: well we have to assume you also tries the SEEK_BYTE option addition to SEEK_BACKWARD On Fri, Aug 29, 2014 at 2:40 PM, Lyndon Hill < emptystate-at-yahoo.co.uk at ffmpeg.org> wrote: > > > > > > On Friday, 29 August 2014, 21:59, wm4 wrote: > > For such files, doing byte based seeks is probably the only thing > > that works. > > Please elaborate. > > Are you suggesting using the standard C library rewind(FILE *) ? > How do you access the file pointer ? > Doesn't that break the AVFormatContext ? > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Sat Aug 30 00:01:59 2014 From: nfxjfg at googlemail.com (wm4) Date: Sat, 30 Aug 2014 00:01:59 +0200 Subject: [Libav-user] Rewind file to start In-Reply-To: References: <1409344930.21008.YahooMailNeo@web172606.mail.ir2.yahoo.com> <20140829225954.56432f62@debian> <1409348443.77207.YahooMailNeo@web172606.mail.ir2.yahoo.com> Message-ID: <20140830000159.5e2a18a8@debian> On Fri, 29 Aug 2014 14:53:53 -0700 J Decker wrote: > well we have to assume you also tries the SEEK_BYTE option addition to > SEEK_BACKWARD > Actually it's AVSEEK_FLAG_BYTE. You'd seek to byte position 0. But this probably works for raw formats only, so be careful when you want something that seeks to the start of a file with any format. Seeking is hard. From fedor_qd at mail.ru Sat Aug 30 11:36:38 2014 From: fedor_qd at mail.ru (=?UTF-8?B?0KTQtdC00L7RgA==?=) Date: Sat, 30 Aug 2014 13:36:38 +0400 Subject: [Libav-user] =?utf-8?q?Symbian_port?= Message-ID: <1409391398.724343212@f421.i.mail.ru> How directly use gas-preprocessor.pl? I download bundle from here - https://git.libav.org/?p=gas-preprocessor.git;a=tree ang try it like described here - https://wiki.libav.org/Tools/gas-preprocessor . I got error : gas-preprocessor.pl gas Unrecognized input filetype at D:\Symbian\Projects\gas-preprocessor\gas-preprocessor.pl line 95. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sat Aug 30 19:45:10 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 30 Aug 2014 17:45:10 +0000 (UTC) Subject: [Libav-user] Symbian port References: <1409391398.724343212@f421.i.mail.ru> Message-ID: ????? writes: > I got error : gas-preprocessor.pl gasUnrecognized input filetype at > D:\Symbian\Projects\gas-preprocessor\gas-preprocessor.pl line 95. When do you get this error? Are you running FFmpeg configure and it reports that it cannot find gas-preprocessor? Or does "make" return an error? Carl Eugen From p.laponder at canaldigitaal.nl Sun Aug 31 11:22:30 2014 From: p.laponder at canaldigitaal.nl (Irene & Peter Laponder) Date: Sun, 31 Aug 2014 11:22:30 +0200 Subject: [Libav-user] Not all subtitles of video.ts file available Message-ID: <000301cfc4fd$1709c540$451d4fc0$@canaldigitaal.nl> When I record a DVB stream (.TS file) with 9 languages (for instance TV5monde Europe does this) ffmpeg seems to limit the selection to the first 4 languages. Is it possible to increase this list or make it dynamic depending on the stream? -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 41803 bytes Desc: not available URL: From cehoyos at ag.or.at Sun Aug 31 12:19:22 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 31 Aug 2014 10:19:22 +0000 (UTC) Subject: [Libav-user] Not all subtitles of video.ts file available References: <000301cfc4fd$1709c540$451d4fc0$@canaldigitaal.nl> Message-ID: Irene & Peter Laponder writes: > When I record a DVB stream (.TS file) with 9 languages > (for instance TV5monde Europe does this) ffmpeg seems > to limit the selection to the first 4 languages. Command line and complete, uncut console output missing. But please understand that imo, FFmpeg is simply not suitable to record dvb, either use mplayer -dumpstream or tzap and cat. Carl Eugen From p.laponder at canaldigitaal.nl Sun Aug 31 13:23:27 2014 From: p.laponder at canaldigitaal.nl (Irene & Peter Laponder) Date: Sun, 31 Aug 2014 13:23:27 +0200 Subject: [Libav-user] Not all subtitles of video.ts file available In-Reply-To: References: <000301cfc4fd$1709c540$451d4fc0$@canaldigitaal.nl> Message-ID: <000001cfc50d$fc71b1f0$f55515d0$@canaldigitaal.nl> I don't use FFmpeg to record. But for instance XBMC and VLC use FFmpeg in their player. And If I playback one of these files I can only choose from 4 languages and not all. I saw somewhere in the source code (unfortunately lost the location) that the subtitles are placed in an array Subtitle[0] , subtitle[1] , subtitle[2], subtitle[3] and no more. Is it possible to increase the size of the array? I tried to compile FFmpeg myself but got lost in all the packages I had to install. -----Oorspronkelijk bericht----- Van: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Namens Carl Eugen Hoyos Verzonden: zondag 31 augustus 2014 12:19 Aan: libav-user at ffmpeg.org Onderwerp: Re: [Libav-user] Not all subtitles of video.ts file available Irene & Peter Laponder writes: > When I record a DVB stream (.TS file) with 9 languages (for instance > TV5monde Europe does this) ffmpeg seems to limit the selection to the > first 4 languages. Command line and complete, uncut console output missing. But please understand that imo, FFmpeg is simply not suitable to record dvb, either use mplayer -dumpstream or tzap and cat. Carl Eugen _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user From cehoyos at ag.or.at Sun Aug 31 17:01:25 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 31 Aug 2014 15:01:25 +0000 (UTC) Subject: [Libav-user] Not all subtitles of video.ts file available References: <000301cfc4fd$1709c540$451d4fc0$@canaldigitaal.nl> <000001cfc50d$fc71b1f0$f55515d0$@canaldigitaal.nl> Message-ID: Irene & Peter Laponder writes: > I don't use FFmpeg to record. But for instance XBMC > and VLC use FFmpeg in their player. And If I > playback one of these files I can only choose from > 4 languages and not all. Then please provide ffmpeg -i yourfile output for one of your recordings. (vlc does not use FFmpeg for transport streams by default and I can assure you that no such array as you describe exists in FFmpeg.) Please do not top-post here, Carl Eugen From p.laponder at canaldigitaal.nl Sun Aug 31 18:51:15 2014 From: p.laponder at canaldigitaal.nl (Irene & Peter Laponder) Date: Sun, 31 Aug 2014 18:51:15 +0200 Subject: [Libav-user] Not all subtitles of video.ts file available In-Reply-To: References: <000301cfc4fd$1709c540$451d4fc0$@canaldigitaal.nl> <000001cfc50d$fc71b1f0$f55515d0$@canaldigitaal.nl> Message-ID: <000001cfc53b$c7cb8560$57629020$@canaldigitaal.nl> The info: ---------------- ffmpeg version N-65991-g8c63a0d Copyright (c) 2000-2014 the FFmpeg developers built on Aug 30 2014 22:02:13 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. 3.100 / 56. 3.100 libavdevice 56. 0.100 / 56. 0.100 libavfilter 5. 0.103 / 5. 0.103 libswscale 3. 0.100 / 3. 0.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 0.100 / 53. 0.100 [mpeg2video @ 02c8a560] Invalid frame dimensions 0x0. Last message repeated 7 times [NULL @ 02c8b780] start time for stream 2 is not set in estimate_timings_from_pts [NULL @ 02c8c200] start time for stream 3 is not set in estimate_timings_from_pts [NULL @ 02c8ccc0] start time for stream 4 is not set in estimate_timings_from_pts [NULL @ 02c8d740] start time for stream 5 is not set in estimate_timings_from_pts [mpegts @ 02c8df80] PES packet size mismatch Last message repeated 1 times Input #0, mpegts, from 'dame_de_sang.ts': Duration: 02:03:41.33, start: 72519.515267, bitrate: 3819 kb/s Program 1 Stream #0:0[0x267]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], 3200 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x27b](fra): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 186 kb/s Stream #0:2[0x3a7](rus): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) Stream #0:3[0x3a8](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) Stream #0:4[0x3ab](esl): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) Stream #0:5[0x3a9](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) Stream #0:6[0x343](000): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006) ---- But I checked also with MPEG-2 TS packet analyser 2.4.5.0 and there I see the languages 03A7 03A8 03AB 03A9 03AA 03AC 03AE -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 69151 bytes Desc: not available URL: From cehoyos at ag.or.at Sun Aug 31 19:44:17 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 31 Aug 2014 17:44:17 +0000 (UTC) Subject: [Libav-user] Not all subtitles of video.ts file available References: <000301cfc4fd$1709c540$451d4fc0$@canaldigitaal.nl> <000001cfc50d$fc71b1f0$f55515d0$@canaldigitaal.nl> <000001cfc53b$c7cb8560$57629020$@canaldigitaal.nl> Message-ID: Irene & Peter Laponder writes: > Stream #0:2[0x3a7](rus): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) > Stream #0:3[0x3a8](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) > Stream #0:4[0x3ab](esl): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) > Stream #0:5[0x3a9](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) You can try -probesize 2G -analyzeduration 2G (smaller values if you are not just testing) or consider uploading a sample. Carl Eugen