From mtaha.ansari at gmail.com Wed Jan 1 12:07:29 2014 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Wed, 1 Jan 2014 16:07:29 +0500 Subject: [Libav-user] webm (vorbis) audio to aac conversion issues Message-ID: Hi, I have written a small program to convert webm (vorbis) audio to aac format, using FFmpeg libraries - C++ (on Windows using 32 bit Zeranoe FFmpeg builds). After writing this program, I find it is sometimes converting files as per expectation, and at other times, results in larger duration files, and audio playback is broken/awkward as well. This code appears to be working fine for mp3, which also uses FLTP format (same as vorbis), so technically both look similar. Please see below sample code I am using: //////////////////////////////////////////////// #include "stdafx.h" #include #include #include #include #include #include #include #include #include #include #include extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" #include "libavutil/dict.h" #include "libavutil/error.h" #include "libavutil/opt.h" #include #include #include #include } AVFormatContext* fmt_ctx= NULL; int audio_stream_index = -1; AVCodecContext * codec_ctx_audio = NULL; AVCodec* codec_audio = NULL; AVFrame* decoded_frame = NULL; uint8_t** audio_dst_data = NULL; int got_frame = 0; int audiobufsize = 0; AVPacket input_packet; int audio_dst_linesize = 0; int audio_dst_bufsize = 0; SwrContext * swr = NULL; AVOutputFormat * output_format = NULL ; AVFormatContext * output_fmt_ctx= NULL; AVStream * audio_st = NULL; AVCodec * audio_codec = NULL; double audio_pts = 0.0; AVFrame * out_frame = avcodec_alloc_frame(); int audio_input_frame_size = 0; uint8_t * audio_data_buf = NULL; uint8_t * audio_out = NULL; int audio_bit_rate; int audio_sample_rate; int audio_channels; int decode_packet(); int open_audio_input(char* src_filename); int decode_frame(); int open_encoder(char* output_filename); AVStream *add_audio_stream(AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id); int open_audio(AVFormatContext *oc, AVCodec *codec, AVStream *st); void close_audio(AVFormatContext *oc, AVStream *st); void write_audio_frame(uint8_t ** audio_src_data, int audio_src_bufsize); int open_audio_input(char* src_filename) { int i =0; /* open input file, and allocate format context */ if (avformat_open_input(&fmt_ctx, src_filename, NULL, NULL) < 0) { fprintf(stderr, "Could not open source file %s\n", src_filename); exit(1); } // Retrieve stream information if(avformat_find_stream_info(fmt_ctx, NULL)<0) return -1; // Couldn't find stream information // Dump information about file onto standard error av_dump_format(fmt_ctx, 0, src_filename, 0); // Find the first video stream for(i=0; inb_streams; i++) { if(fmt_ctx->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO) { audio_stream_index=i; break; } } if ( audio_stream_index != -1 ) { // Get a pointer to the codec context for the audio stream codec_ctx_audio=fmt_ctx->streams[audio_stream_index]->codec; // Find the decoder for the video stream codec_audio=avcodec_find_decoder(codec_ctx_audio->codec_id); if(codec_audio==NULL) { fprintf(stderr, "Unsupported audio codec!\n"); return -1; // Codec not found } // Open codec AVDictionary *codecDictOptions = NULL; if(avcodec_open2(codec_ctx_audio, codec_audio, &codecDictOptions)<0) return -1; // Could not open codec // Set up SWR context once you've got codec information swr = swr_alloc(); av_opt_set_int(swr, "in_channel_layout", codec_ctx_audio->channel_layout, 0); av_opt_set_int(swr, "out_channel_layout", codec_ctx_audio->channel_layout, 0); av_opt_set_int(swr, "in_sample_rate", codec_ctx_audio->sample_rate, 0); av_opt_set_int(swr, "out_sample_rate", codec_ctx_audio->sample_rate, 0); av_opt_set_sample_fmt(swr, "in_sample_fmt", codec_ctx_audio->sample_fmt, 0); av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); swr_init(swr); // Allocate audio frame if ( decoded_frame == NULL ) decoded_frame = avcodec_alloc_frame(); int nb_planes = 0; AVStream* audio_stream = fmt_ctx->streams[audio_stream_index]; nb_planes = av_sample_fmt_is_planar(codec_ctx_audio->sample_fmt) ? codec_ctx_audio->channels : 1; int tempSize = sizeof(uint8_t *) * nb_planes; audio_dst_data = (uint8_t**)av_mallocz(tempSize); if (!audio_dst_data) { fprintf(stderr, "Could not allocate audio data buffers\n"); } else { for ( int i = 0 ; i < nb_planes ; i ++ ) { audio_dst_data[i] = NULL; } } } } int decode_frame() { int rv = 0; got_frame = 0; if ( fmt_ctx == NULL ) { return rv; } int ret = 0; audiobufsize = 0; rv = av_read_frame(fmt_ctx, &input_packet); if ( rv < 0 ) { return rv; } rv = decode_packet(); // Free the input_packet that was allocated by av_read_frame av_free_packet(&input_packet); return rv; } int decode_packet() { int rv = 0; int ret = 0; //audio stream? if(input_packet.stream_index == audio_stream_index) { /* decode audio frame */ rv = avcodec_decode_audio4(codec_ctx_audio, decoded_frame, &got_frame, &input_packet); if (rv < 0) { fprintf(stderr, "Error decoding audio frame\n"); //return ret; } else { if (got_frame) { if ( audio_dst_data[0] == NULL ) { ret = av_samples_alloc(audio_dst_data, &audio_dst_linesize, decoded_frame->channels, decoded_frame->nb_samples, (AVSampleFormat)decoded_frame->format, 1); if (ret < 0) { fprintf(stderr, "Could not allocate audio buffer\n"); return AVERROR(ENOMEM); } /* TODO: extend return code of the av_samples_* functions so that this call is not needed */ audio_dst_bufsize = av_samples_get_buffer_size(NULL, audio_st->codec->channels, decoded_frame->nb_samples, (AVSampleFormat)decoded_frame->format, 1); //int16_t* outputBuffer = ...; swr_convert(swr, audio_dst_data, out_frame->nb_samples, (const uint8_t **)(decoded_frame->data), decoded_frame->nb_samples); //swr_convert( swr, audio_dst_data, out_frame->nb_samples, (const uint8_t**) decoded_frame->extended_data, decoded_frame->nb_samples ); } /* copy audio data to destination buffer: * this is required since rawaudio expects non aligned data */ //av_samples_copy(audio_dst_data, decoded_frame->data, 0, 0, // decoded_frame->nb_samples, decoded_frame->channels, (AVSampleFormat)decoded_frame->format); } } } return rv; } int open_encoder(char* output_filename ) { int rv = 0; /* allocate the output media context */ AVOutputFormat *opfmt = NULL; avformat_alloc_output_context2(&output_fmt_ctx, opfmt, NULL, output_filename); if (!output_fmt_ctx) { printf("Could not deduce output format from file extension: using MPEG.\n"); avformat_alloc_output_context2(&output_fmt_ctx, NULL, "mpeg", output_filename); } if (!output_fmt_ctx) { rv = -1; } else { output_format = output_fmt_ctx->oformat; } /* Add the audio stream using the default format codecs * and initialize the codecs. */ audio_st = NULL; if ( output_fmt_ctx ) { if (output_format->audio_codec != AV_CODEC_ID_NONE) { audio_st = add_audio_stream(output_fmt_ctx, &audio_codec, output_format->audio_codec); } /* Now that all the parameters are set, we can open the audio and * video codecs and allocate the necessary encode buffers. */ if (audio_st) { rv = open_audio(output_fmt_ctx, audio_codec, audio_st); if ( rv < 0 ) return rv; } av_dump_format(output_fmt_ctx, 0, output_filename, 1); /* open the output file, if needed */ if (!(output_format->flags & AVFMT_NOFILE)) { if (avio_open(&output_fmt_ctx->pb, output_filename, AVIO_FLAG_WRITE) < 0) { fprintf(stderr, "Could not open '%s'\n", output_filename); rv = -1; } else { /* Write the stream header, if any. */ if (avformat_write_header(output_fmt_ctx, NULL) < 0) { fprintf(stderr, "Error occurred when opening output file\n"); rv = -1; } } } } return rv; } AVStream *add_audio_stream(AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id) { AVCodecContext *c; AVStream *st; /* find the audio encoder */ *codec = avcodec_find_encoder(codec_id); if (!(*codec)) { fprintf(stderr, "Could not find codec\n"); exit(1); } st = avformat_new_stream(oc, *codec); if (!st) { fprintf(stderr, "Could not allocate stream\n"); exit(1); } st->id = 1; c = st->codec; /* put sample parameters */ c->sample_fmt = AV_SAMPLE_FMT_S16; c->bit_rate = audio_bit_rate; c->sample_rate = audio_sample_rate; c->channels = audio_channels; // some formats want stream headers to be separate if (oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= CODEC_FLAG_GLOBAL_HEADER; return st; } int open_audio(AVFormatContext *oc, AVCodec *codec, AVStream *st) { int ret=0; AVCodecContext *c; st->duration = fmt_ctx->duration; c = st->codec; /* open it */ ret = avcodec_open2(c, codec, NULL) ; if ( ret < 0) { fprintf(stderr, "could not open codec\n"); return -1; //exit(1); } if (c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) audio_input_frame_size = 10000; else audio_input_frame_size = c->frame_size; int tempSize = audio_input_frame_size * av_get_bytes_per_sample(c->sample_fmt) * c->channels; return ret; } void close_audio(AVFormatContext *oc, AVStream *st) { avcodec_close(st->codec); } void write_audio_frame(uint8_t ** audio_src_data, int audio_src_bufsize) { AVFormatContext *oc = output_fmt_ctx; AVStream *st = audio_st; if ( oc == NULL || st == NULL ) return; AVCodecContext *c; AVPacket pkt = { 0 }; // data and size must be 0; int got_packet; av_init_packet(&pkt); c = st->codec; out_frame->nb_samples = audio_input_frame_size; int buf_size = audio_src_bufsize * av_get_bytes_per_sample(c->sample_fmt) * c->channels; avcodec_fill_audio_frame(out_frame, c->channels, c->sample_fmt, (uint8_t *) *audio_src_data, buf_size, 1); avcodec_encode_audio2(c, &pkt, out_frame, &got_packet); if (!got_packet) { } else { if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, st->codec->time_base, st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, st->codec->time_base, st->time_base); if ( c && c->coded_frame && c->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; pkt.stream_index = st->index; pkt.flags |= AV_PKT_FLAG_KEY; /* Write the compressed frame to the media file. */ if (av_interleaved_write_frame(oc, &pkt) != 0) { fprintf(stderr, "Error while writing audio frame\n"); exit(1); } } av_free_packet(&pkt); } void write_delayed_frames(AVFormatContext *oc, AVStream *st) { AVCodecContext *c = st->codec; int got_output = 0; int ret = 0; AVPacket pkt; pkt.data = NULL; pkt.size = 0; av_init_packet(&pkt); int i = 0; for (got_output = 1; got_output; i++) { ret = avcodec_encode_audio2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "error encoding frame\n"); exit(1); } static int64_t tempPts = 0; static int64_t tempDts = 0; /* If size is zero, it means the image was buffered. */ if (got_output) { if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, st->codec->time_base, st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, st->codec->time_base, st->time_base); if ( c && c->coded_frame && c->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; pkt.stream_index = st->index; /* Write the compressed frame to the media file. */ ret = av_interleaved_write_frame(oc, &pkt); } else { ret = 0; } av_free_packet(&pkt); } } int main(int argc, char **argv) { /* register all formats and codecs */ av_register_all(); avcodec_register_all(); avformat_network_init(); avdevice_register_all(); int i =0; int ret=0; char src_filename[90] = "test_a.webm"; char dst_filename[90] = "output.aac"; open_audio_input(src_filename); if ( codec_ctx_audio->bit_rate == 0 ) codec_ctx_audio->bit_rate = 112000; audio_bit_rate = codec_ctx_audio->bit_rate; audio_sample_rate = codec_ctx_audio->sample_rate; audio_channels = codec_ctx_audio->channels; open_encoder( dst_filename ); while(1) { int rv = decode_frame(); if ( rv < 0 ) { break; } if (audio_st) { audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den; } else { audio_pts = 0.0; } if ( codec_ctx_audio ) { if ( got_frame) { write_audio_frame( audio_dst_data, audio_dst_bufsize ); } } if ( audio_dst_data[0] ) { av_freep(&audio_dst_data[0]); audio_dst_data[0] = NULL; } printf("\naudio_pts: %.3f", audio_pts); } while(1) { if ( audio_dst_data && audio_dst_data[0] ) { av_freep(&audio_dst_data[0]); audio_dst_data[0] = NULL; } ret = av_samples_alloc(audio_dst_data, NULL, codec_ctx_audio->channels, decoded_frame->nb_samples, AV_SAMPLE_FMT_S16, 0); ret = swr_convert(swr, audio_dst_data, out_frame->nb_samples,NULL, 0); if ( ret <= 0 ) break; write_audio_frame( audio_dst_data, audio_dst_bufsize ); } write_delayed_frames( output_fmt_ctx, audio_st ); av_write_trailer(output_fmt_ctx); close_audio( output_fmt_ctx, audio_st); swr_free(&swr); avcodec_free_frame(&out_frame); getch(); return 0; } "test_a.webm" input file results in longer duration (40 second output), and if I change it to "jet.webm", it is converted fine. Both input files are approximately 18 second duration. For reference, these files can be downloaded from links below: http://www.filedropper.com/testa , http://www.filedropper.com/jet Alternatively, they are zipped and uploaded elsewhere as well: http://www.files.com/shared/52c3eefe990ea/test_audio_files.zip Could someone kindly guide on what I am doing wrong here? Thanks in advance... p.s. These files are taken/extracted from different online sources/demos; also posted on SO: http://stackoverflow.com/questions/20867959/ffmpeg-library-webm-vorbis-audio-to-aac-conversion -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Jan 1 16:53:14 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 1 Jan 2014 15:53:14 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?any_way_to_interrupt_avcodec=5Fdecode=5Fvi?= =?utf-8?q?deo2_=3F?= References: <26EAA74A8984475C8A5864227C177558@MANLAP> Message-ID: Don Moir writes: > A simple seek to zero is quick, but if I have to wait on > avcodec_decode_video2 to return, then its slower and can > be quite slow. Yes, this is exactly what CODEC_FLAG2_SHOW_ALL is for. Carl Eugen From donmoir at comcast.net Wed Jan 1 17:14:36 2014 From: donmoir at comcast.net (Don Moir) Date: Wed, 01 Jan 2014 16:14:36 -0000 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? References: <26EAA74A8984475C8A5864227C177558@MANLAP> Message-ID: ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Wednesday, January 01, 2014 10:53 AM Subject: Re: [Libav-user]any way to interrupt avcodec_decode_video2 ? > Don Moir writes: > >> A simple seek to zero is quick, but if I have to wait on >> avcodec_decode_video2 to return, then its slower and can >> be quite slow. > > Yes, this is exactly what CODEC_FLAG2_SHOW_ALL is for. > > Carl Eugen CODEC_FLAG2_SHOW_ALL ///< Show all frames before the first keyframe So show garbage? What does that have to do with how fast avcodec_decode_video2 returns? It's not about getting a finished frame. From cehoyos at ag.or.at Wed Jan 1 21:01:25 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 1 Jan 2014 20:01:25 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?any_way_to_interrupt_avcodec=5Fdecode=5Fvi?= =?utf-8?q?deo2_=3F?= References: <26EAA74A8984475C8A5864227C177558@MANLAP> Message-ID: Don Moir writes: > >> A simple seek to zero is quick, but if I have to wait on > >> avcodec_decode_video2 to return, then its slower and can > >> be quite slow. > > > > Yes, this is exactly what CODEC_FLAG2_SHOW_ALL is for. > CODEC_FLAG2_SHOW_ALL ///< Show all frames before the first > keyframe > > So show garbage? What does that have to do with how fast > avcodec_decode_video2 returns? >From a purely technical point-of-view, one could probably argue that CODEC_FLAG2_SHOW_ALL only affects how fast avcodec_decode_video2() returns. Once you have verified this solves the performance problem you see (remember that as explained on irc, nobody understands your reports), you can worry about the "garbage": Either it is possible to call the decode function as often as necessary (I am not sure) or it will be trivial to add such a return flag compared to the callback you suggest. I agree with you that multi-threading may not help in your use case because of its large overhead. Carl Eugen From donmoir at comcast.net Wed Jan 1 22:26:47 2014 From: donmoir at comcast.net (Don Moir) Date: Wed, 01 Jan 2014 21:26:47 -0000 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? References: <26EAA74A8984475C8A5864227C177558@MANLAP> Message-ID: ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Wednesday, January 01, 2014 3:01 PM Subject: Re: [Libav-user]any way to interrupt avcodec_decode_video2 ? > Don Moir writes: > >> >> A simple seek to zero is quick, but if I have to wait on >> >> avcodec_decode_video2 to return, then its slower and can >> >> be quite slow. >> > >> > Yes, this is exactly what CODEC_FLAG2_SHOW_ALL is for. > >> CODEC_FLAG2_SHOW_ALL ///< Show all frames before the first >> keyframe >> >> So show garbage? What does that have to do with how fast >> avcodec_decode_video2 returns? > > From a purely technical point-of-view, one could probably > argue that CODEC_FLAG2_SHOW_ALL only affects how fast > avcodec_decode_video2() returns. Checked and CODEC_FLAG2_SHOW_ALL doesn't seem to have any effect at all on return speed. Checked with some H264 files. I am not sure what it does anymore. Way back I believe every call to avcodec_decode_video2 returned a finished frame when using CODEC_FLAG2_SHOW_ALL on every call even if garbage. Not so now and not sure if it had any effect because don't seem to get garbage and don't get finished frame on every call. > Once you have verified this solves the performance problem > you see (remember that as explained on irc, nobody understands > your reports), Sometimes I try to give you the benefit of knowing something and sometimes I may not be able to communicate via text well. In this case orignally I used the word finish and realize I should not have but others did understand. > you can worry about the "garbage": Either it > is possible to call the decode function as often as necessary > (I am not sure) or it will be trivial to add such a return > flag compared to the callback you suggest. ?? > I agree with you that multi-threading may not help in your > use case because of its large overhead. > > Carl Eugen From duanyong.2003112 at gmail.com Thu Jan 2 06:44:31 2014 From: duanyong.2003112 at gmail.com (duanyong_gmail) Date: Thu, 2 Jan 2014 13:44:31 +0800 Subject: [Libav-user] submit code for integrating FFMPEG to Android AwesomePlayer Message-ID: hello everyone, I am a stuff of Xiaomi in China and have integrated FFMPEG to Android AwesomePlayer as its internal modules and is currently running well on our TV product. FFMPEG is a very popular player for many open source projects and I do not know if there is any contribution to Android, if possible, I want to submit our code to FFMPEG project; these code are very independent, will not affect any of FFMPEG source code and I intend to provide a very convenient way for both building and integrating. Thanks and appreciate your help. BR duanyong -------------- next part -------------- An HTML attachment was scrubbed... URL: From ierumshanaya85 at gmail.com Thu Jan 2 08:44:51 2014 From: ierumshanaya85 at gmail.com (Ierum Shanaya) Date: Thu, 2 Jan 2014 13:14:51 +0530 Subject: [Libav-user] multithreading video decoding support using ffmpeg Message-ID: hi, I tried looking into the documentation of how to use multithreading to decode a h264 or mpg video static file, but could not find any detailed note. Could you please help me understand - how can we use multithreading to decode an incoming static video stream. If you can share me some sample programs , it would be of great help. Thanks, Ierum -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Jan 2 20:24:21 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 2 Jan 2014 19:24:21 +0000 (UTC) Subject: [Libav-user] multithreading video decoding support using ffmpeg References: Message-ID: Ierum Shanaya writes: > I tried looking into the documentation of how to use > multithreading to decode a h264 or mpg video static file, > but could not find any detailed note. > ? > Could you please help me understand - how can we use > multithreading to decode an incoming static video stream. Set thread_count in AVCodecContext to the number of threads that libavcodec should use, 0 for autodetection of cpu cores. Note that some decoders do not support multithreading (h264 does). Carl Eugen From cehoyos at ag.or.at Thu Jan 2 20:27:13 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 2 Jan 2014 19:27:13 +0000 (UTC) Subject: [Libav-user] submit code for integrating FFMPEG to Android AwesomePlayer References: Message-ID: duanyong_gmail writes: > I am a stuff of Xiaomi in China and have integrated > FFMPEG to Android AwesomePlayer as its internal modules > and is currently running well on our TV product. Great! Where is the source code of FFmpeg you used? That may make integration of your changes easy. Carl Eugen From alexcohn at netvision.net.il Thu Jan 2 20:34:20 2014 From: alexcohn at netvision.net.il (Alex Cohn) Date: Thu, 2 Jan 2014 21:34:20 +0200 Subject: [Libav-user] submit code for integrating FFMPEG to Android AwesomePlayer In-Reply-To: References: Message-ID: On 2 Jan 2014 20:38, "duanyong_gmail" wrote: > > hello everyone, > I am a stuff of Xiaomi in China and have integrated FFMPEG to Android AwesomePlayer as its internal modules and is currently running well on our TV product. > FFMPEG is a very popular player for many open source projects and I do not know if there is any contribution to Android, if possible, I want to submit our code to FFMPEG project; these code are very independent, will not affect any of FFMPEG source code and I intend to provide a very convenient way for both building and integrating. > > Thanks and appreciate your help. > > BR > duanyong This would be awesome! Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From grisme at yandex.ru Fri Jan 3 08:05:33 2014 From: grisme at yandex.ru (=?koi8-r?B?5dfHxc7JyiDnwdLJxtXMzMnO?=) Date: Fri, 03 Jan 2014 13:05:33 +0600 Subject: [Libav-user] multithreading video decoding support using ffmpeg In-Reply-To: References: Message-ID: <52811388732733@web27j.yandex.ru> 03.01.2014, 00:38, "Ierum Shanaya" : > hi, > > I tried looking into the documentation of how to use multithreading to decode a h264 or mpg video static file, but could not find any detailed note. > > Could you please help me understand - how can we use multithreading to decode an incoming static video stream. > > If you can share me some sample programs , it would be of great help. > > Thanks, > Ierum threads for multithreading decoding (AVCodecContext::thread_count) must be set _before_ call to avcodec_open(). -- ? ?????????, ??????? ??????????. e-mail: grisme at yandex.ru jabber: joffadark at jabber.ufanet.ru ICQ : 387906261 From ierumshanaya85 at gmail.com Fri Jan 3 08:22:02 2014 From: ierumshanaya85 at gmail.com (Ierum Shanaya) Date: Fri, 3 Jan 2014 12:52:02 +0530 Subject: [Libav-user] multithreading video decoding support using ffmpeg In-Reply-To: <52811388732733@web27j.yandex.ru> References: <52811388732733@web27j.yandex.ru> Message-ID: Thanks for the quick response!! 2 queries: 1) Do we have to also set the thread_type ( thread_type = FF_THREAD_FRAME|FF_THREAD_SLICE) ? or Just by setting the thread count (AVCodecContext::thread_count) before avcodec_open() works? 2) Do we have to do the thread synchorinization also? or ffmpeg library handles that.. Because I had read in some links/discussions, that the functions avcodec_open() and avcodec_close() are not thread safe? Thanks, Ierum On Fri, Jan 3, 2014 at 12:35 PM, ??????? ?????????? wrote: > > 03.01.2014, 00:38, "Ierum Shanaya" : > > hi, > > > > I tried looking into the documentation of how to use multithreading to > decode a h264 or mpg video static file, but could not find any detailed > note. > > > > Could you please help me understand - how can we use multithreading to > decode an incoming static video stream. > > > > If you can share me some sample programs , it would be of great help. > > > > Thanks, > > Ierum > > threads for multithreading decoding (AVCodecContext::thread_count) must be > set _before_ call to avcodec_open(). > > -- > ? ?????????, ??????? ??????????. > e-mail: grisme at yandex.ru > jabber: joffadark at jabber.ufanet.ru > ICQ : 387906261 > _______________________________________________ > 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 grisme at yandex.ru Fri Jan 3 08:41:08 2014 From: grisme at yandex.ru (=?koi8-r?B?5dfHxc7JyiDnwdLJxtXMzMnO?=) Date: Fri, 03 Jan 2014 13:41:08 +0600 Subject: [Libav-user] multithreading video decoding support using ffmpeg In-Reply-To: References: <52811388732733@web27j.yandex.ru> Message-ID: <96611388734868@web2m.yandex.ru> about 1) i think, you must to set thread_type values. when you call avcodec_open(), it calls validate_thread_parameters(). validate_thread_parameters corrects AVCodecContext::active_thread_type member via AVCodecContext::thread_count and AVCodecContext::thread_type values. about 2) ffmpeg library must handles that. :) again: after you call avcodec_open(): avcodec_open() calls ffmpeg_thread_init() and frame_thread_init(). you must check it. this is not accurate information from me. 03.01.2014, 13:22, "Ierum Shanaya" : > Thanks for the quick response!! > > 2 queries: > > 1) Do we have to also set the thread_type ( thread_type = FF_THREAD_FRAME|FF_THREAD_SLICE) ? or Just by setting the thread count (AVCodecContext::thread_count) before avcodec_open() works? > > 2) Do we have to do the thread synchorinization also? or ffmpeg library handles that.. Because I had read in some links/discussions, that the functions avcodec_open() and avcodec_close() are not thread safe? > > Thanks, > Ierum > > On Fri, Jan 3, 2014 at 12:35 PM, ??????? ?????????? wrote: >> 03.01.2014, 00:38, "Ierum Shanaya" : >>> hi, >>> >>> I tried looking into the documentation of how to use multithreading to decode a h264 or mpg video static file, but could not find any detailed note. >>> >>> Could you please help me understand - how can we use multithreading to decode an incoming static video stream. >>> >>> If you can share me some sample programs , it would be of great help. >>> >>> Thanks, >>> Ierum >> >> threads for multithreading decoding (AVCodecContext::thread_count) must be set _before_ call to avcodec_open(). >> >> -- >> ? ?????????, ??????? ??????????. >> e-mail: grisme at yandex.ru >> jabber: joffadark at jabber.ufanet.ru >> ICQ : 387906261 >> _______________________________________________ >> 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 -- ? ?????????, ??????? ??????????. e-mail: grisme at yandex.ru jabber: joffadark at jabber.ufanet.ru ICQ : 387906261 From gomb1729 at gmail.com Mon Jan 6 12:44:13 2014 From: gomb1729 at gmail.com (m m) Date: Mon, 6 Jan 2014 13:44:13 +0200 Subject: [Libav-user] How to concat videos Message-ID: Hello, I have a problem making a preview video of the bigger one (by making few short clips and concatenating them into one smaller video). I already successfully implemented seeking and making temporary clip files (using libs: avformat, avcodec and avutil). Can someone provide an example or direct to tutorial in C/C++, which libs, methods and parameters should be used to concatenate videos? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From grisme at yandex.ru Mon Jan 6 17:09:06 2014 From: grisme at yandex.ru (=?koi8-r?B?5dfHxc7JyiDnwdLJxtXMzMnO?=) Date: Mon, 06 Jan 2014 22:09:06 +0600 Subject: [Libav-user] How to concat videos In-Reply-To: References: Message-ID: <22471389024546@web18j.yandex.ru> 06.01.2014, 17:44, "m m" : > Hello, > > I have a problem making a preview video of the bigger one (by making few short clips and concatenating them into one smaller video). > > I already successfully implemented seeking and making temporary clip files (using libs: avformat, avcodec and avutil). > Can someone provide an example or direct to tutorial in C/C++, which libs, methods and parameters should be used to concatenate videos? > > Thanks in advance! > > , > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user I think, you can open input-file format context, output format context (equals input format context), output stream with format as input file. Seek at places that you want to combine, read frames from input format-context, and write directly to output file. -- ? ?????????, ??????? ??????????. e-mail: grisme at yandex.ru jabber: joffadark at jabber.ufanet.ru ICQ : 387906261 From cehoyos at ag.or.at Mon Jan 6 21:18:32 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 6 Jan 2014 20:18:32 +0000 (UTC) Subject: [Libav-user] How to concat videos References: Message-ID: m m writes: > I have a problem making a preview video of the bigger > one (by making few short clips and concatenating them > into one smaller video). There is a concat protocol, a concat demuxer and a concat filter. Depending on your use case, all three of them may work, consider testing from the command line first. Carl Eugen From mrfun.china at gmail.com Wed Jan 8 03:55:19 2014 From: mrfun.china at gmail.com (YIRAN LI) Date: Wed, 8 Jan 2014 13:55:19 +1100 Subject: [Libav-user] how to get title duration in an ISO file Message-ID: Hi, I'm reading an ISO file which was made from a DVD disc and contains 2 titles (both have duration of 1 min). [image: ???? 1] But if I run ffprobe, the duration it returns is duration of one single title $ ffprobe.exe 2videos.iso ffprobe version N-58485-ga12b4bd Copyright (c) 2007-2013 the FFmpeg developers built on Nov 26 2013 22:01:46 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 55.100 / 52. 55.100 libavcodec 55. 44.100 / 55. 44.100 libavformat 55. 21.102 / 55. 21.102 libavdevice 55. 5.101 / 55. 5.101 libavfilter 3. 91.100 / 3. 91.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Input #0, mpeg, from '2videos.iso': Duration: 00:01:00.06, start: 0.033367, bitrate: 9423 kb/s Stream #0:0[0x1bf]: Data: dvd_nav_packet Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 96 kb/s Stream #0:2[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 8:9 DAR 4:3], max. 9000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Unsupported codec with id 1145979222 for input stream 0 and also if I open the ISO using av_open_input_stream(&pFormatCtx, &bioCtx, pszISOPath, av_find_input_format("mpeg"), NULL); then the pFormatCtx will have 3 streams (1 for data, 1 video and 1 audio), and the video stream's duration is also only 1 min Our application uses the duration to init the timeline, and provide a read_packet for custom I/O. I'd like to know if there's any ffmpeg interface we can use to check the duration of each title? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 30882 bytes Desc: not available URL: From manuel at yondbee.com Wed Jan 8 12:57:15 2014 From: manuel at yondbee.com (Yondbee Code 2) Date: Wed, 8 Jan 2014 12:57:15 +0100 Subject: [Libav-user] How to encode JPEG images as video frames Message-ID: Hello. Im trying to generate a video file from a collection of images, in JPEG. I've look at your example here: http://ffmpeg.org/pipermail/libav-user/2011-July/000428.html Im stuck in the same spot you were? I know its been a long time, but can you help me on fixing the problem. Thanks From rongyan236 at gmail.com Thu Jan 9 08:58:36 2014 From: rongyan236 at gmail.com (Grace Ryan) Date: Thu, 9 Jan 2014 15:58:36 +0800 Subject: [Libav-user] Does FFmpeg accept the contribution of source code now Message-ID: Hi, Everyone It is my first in this maillist. A very simple question, does FFmpeg still accept the contribution of source code now? Thanks. Best, Rong Yan -------------- next part -------------- An HTML attachment was scrubbed... URL: From yamusanivinay at gmail.com Thu Jan 9 10:29:33 2014 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Thu, 9 Jan 2014 14:59:33 +0530 Subject: [Libav-user] limit noise obtained from audio Message-ID: Hi All, I am using ffmpeg in my android app for playing audio.I applied some filters like bass,equalizer.It is working fine but when i try to give high gain values for both equalizer and bass.I am getting huge distortion.Is there any way to limit distortion obtained from audio?..(I cannot reduce gain it is must). Thanks&Regards, bitfield. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Jan 9 11:25:35 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 9 Jan 2014 10:25:35 +0000 (UTC) Subject: [Libav-user] Does FFmpeg accept the contribution of source code now References: Message-ID: Grace Ryan writes: > A very simple question, does FFmpeg still accept the > contribution of source code now? Only patches sent to ffmpeg-devel for review can be accepted. Don't forget to read http://ffmpeg.org/contact.html and http://ffmpeg.org/developer.html carefully! Carl Eugen From mtaha.ansari at gmail.com Thu Jan 9 13:44:40 2014 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Thu, 9 Jan 2014 17:44:40 +0500 Subject: [Libav-user] Muxing sample under 'docs' section compatibility with webm format Message-ID: Hi, I am using FFmpeg zeranoe build downloaded on Aug 30 2013. Running ffmpeg.exe outputs following data: ffmpeg version N-55922-g454a11a Copyright (c) 2000-2013 the FFmpeg developers built on Aug 30 2013 18:04:08 with gcc 4.7.3 (GCC) configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --ena ble-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --e nable-libcaca --enable-libfreetype --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-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --e nable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 43.100 / 52. 43.100 libavcodec 55. 29.100 / 55. 29.100 libavformat 55. 15.100 / 55. 15.100 libavdevice 55. 3.100 / 55. 3.100 libavfilter 3. 82.102 / 3. 82.102 libswscale 2. 5.100 / 2. 5.100 libswresample 0. 17.103 / 0. 17.103 libpostproc 52. 3.100 / 52. 3.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfi le}... I compiled and ran muxing.c sample under windows; while it is working for some other common formats, for webm file, I get the video content, but dummy audio is not audible. Looking further, I discover that audio_pts values are greatly off. Also read this bug report here: http://trac.ffmpeg.org/ticket/3231 , but I don't know if it was resolved (and Windows build uploaded). Does anyone have working muxing.c code that spews correct audio_pts values (hence audible audio)? Merely following the patch that OP posted in above link only provides starting few samples to be audible, rest is still missing. Code hosted here: https://gist.github.com/anonymous/12a6210985814c9d5f09 Thanks for any pointers in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hemiao_1990 at 126.com Thu Jan 9 16:05:43 2014 From: hemiao_1990 at 126.com (hemiao) Date: Thu, 09 Jan 2014 23:05:43 +0800 Subject: [Libav-user] swr_convert crashed when convert format S16P to FLTP Message-ID: <52CEBAC7.1000204@126.com> hi,everyone my audio source file's format is s16p. when i use swr_convert function to convert it to fltp or dblp, the function crashed, without return value or error message. but when i convert it to flt or dbl, it works fine. so why? From stefasab at gmail.com Thu Jan 9 20:38:12 2014 From: stefasab at gmail.com (Stefano Sabatini) Date: Thu, 9 Jan 2014 20:38:12 +0100 Subject: [Libav-user] Muxing sample under 'docs' section compatibility with webm format In-Reply-To: References: Message-ID: <20140109193812.GK2655@barisone> On date Thursday 2014-01-09 17:44:40 +0500, Taha Ansari encoded: [...] > I compiled and ran muxing.c sample under windows; while it is working for > some other common formats, for webm file, I get the video content, but > dummy audio is not audible. Looking further, I discover that audio_pts > values are greatly off. Also read this bug report here: > http://trac.ffmpeg.org/ticket/3231 , but I don't know if it was resolved > (and Windows build uploaded). Should be fixed in git master. Feel free to reopen the ticket if it is not. From mtaha.ansari at gmail.com Fri Jan 10 08:37:10 2014 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Fri, 10 Jan 2014 12:37:10 +0500 Subject: [Libav-user] Muxing sample under 'docs' section compatibility with webm format In-Reply-To: <20140109193812.GK2655@barisone> References: <20140109193812.GK2655@barisone> Message-ID: On Fri, Jan 10, 2014 at 12:38 AM, Stefano Sabatini wrote: > On date Thursday 2014-01-09 17:44:40 +0500, Taha Ansari encoded: > [...] > > I compiled and ran muxing.c sample under windows; while it is working for > > some other common formats, for webm file, I get the video content, but > > dummy audio is not audible. Looking further, I discover that audio_pts > > values are greatly off. Also read this bug report here: > > http://trac.ffmpeg.org/ticket/3231 , but I don't know if it was > resolved > > (and Windows build uploaded). > > > Should be fixed in git master. Feel free to reopen the ticket if it is > not. > I got latest build: git-d9481dc (2014-01-10), which integrates fine with my test project, but the problem has not gone away with the the updated muxing.c sample - it now takes forever to run (audio_time and video_time accumulates really slowly), in the end its very fast forward motion, and initial sound chunk that repeats itself over and over again (tested with webm and mp4 containers). Sure, I'll re-open the ticket... -------------- next part -------------- An HTML attachment was scrubbed... URL: From mtaha.ansari at gmail.com Fri Jan 10 08:44:47 2014 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Fri, 10 Jan 2014 12:44:47 +0500 Subject: [Libav-user] Muxing sample under 'docs' section compatibility with webm format In-Reply-To: References: <20140109193812.GK2655@barisone> Message-ID: > > > Should be fixed in git master. Feel free to reopen the ticket if it is >> not. >> > > > I got latest build: git-d9481dc (2014-01-10), which integrates fine with > my test project, but the problem has not gone away with the the updated > muxing.c sample - it now takes forever to run (audio_time and video_time > accumulates really slowly), in the end its very fast forward motion, and > initial sound chunk that repeats itself over and over again (tested with > webm and mp4 containers). > > Sure, I'll re-open the ticket... > Sorry, my bad. I was doing something wrong - issue is no longer there; many thanks for your timely email! -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefasab at gmail.com Fri Jan 10 09:21:59 2014 From: stefasab at gmail.com (Stefano Sabatini) Date: Fri, 10 Jan 2014 09:21:59 +0100 Subject: [Libav-user] swr_convert crashed when convert format S16P to FLTP In-Reply-To: <52CEBAC7.1000204@126.com> References: <52CEBAC7.1000204@126.com> Message-ID: <20140110082159.GL2655@barisone> On date Thursday 2014-01-09 23:05:43 +0800, hemiao encoded: > hi,everyone > > my audio source file's format is s16p. when i use swr_convert function > to convert it to fltp or dblp, the function crashed, without return > value or error message. > but when i convert it to flt or dbl, it works fine. so why? Please open a ticket if you're able to consistently reproduce the error. Are you able to reproduce the issue with ffmpeg or with doc/examples/resampling.c? -- FFmpeg = Forgiving Formidable Martial Philosofic Eager Guide From yamusanivinay at gmail.com Fri Jan 10 10:42:48 2014 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Fri, 10 Jan 2014 15:12:48 +0530 Subject: [Libav-user] swr_convert crashed when convert format S16P to FLTP In-Reply-To: <52CEBAC7.1000204@126.com> References: <52CEBAC7.1000204@126.com> Message-ID: can you please post the code you used..so we can understand the issue.. On Thu, Jan 9, 2014 at 8:35 PM, hemiao wrote: > hi,everyone > > my audio source file's format is s16p. when i use swr_convert function > to convert it to fltp or dblp, the function crashed, without return > value or error message. > but when i convert it to flt or dbl, it works fine. so why? > > _______________________________________________ > 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 hadi.hadizadeh at hotmail.com Fri Jan 10 17:14:36 2014 From: hadi.hadizadeh at hotmail.com (Hadi) Date: Fri, 10 Jan 2014 08:14:36 -0800 Subject: [Libav-user] Unable to receive RTP payload type 96 without an SDP file describing it Message-ID: Hi,? I am trying to open a video stream at a RTP address using the following command: char *url = "rtp://127.0.0.1:1234"; AVFormatContext *oc = NULL; avformat_open_input(&oc, url, NULL , NULL); But I get the following error: [rtp @ 028568e0] Unable to receive RTP payload type 96 without an SDP file describing it. Do you know what is the problem, and how we can solve it? Thanks! From mani95lisa at gmail.com Fri Jan 10 10:31:03 2014 From: mani95lisa at gmail.com (Mani Wang) Date: Fri, 10 Jan 2014 17:31:03 +0800 Subject: [Libav-user] Can I encode and decode bytes in audio by FFmpeg? Message-ID: Hi, guys? Thanks for your time to read my email first. I?m new about audio, but I have to make this done:? 1. Add a few bytes of data to a sound file and generate a new sound file.? 2. If I convert that file to any sound format, these bytes data should still there.? 3. When I play that file anywhere, I pick up the sound with mobile phone microphone and got these bytes back.? The most important is ?Encoding? and ?Decoding?, can FFmpeg encode and decode? Like this paper said:?HIDING TEXT IN AUDIO USING MULTIPLE LSB? STEGANOGRAPHY AND PROVIDE SECURITY? USING CRYPTOGRAPHY Thank you in advance for any help you might be able to provide.? Best Regards,? Mani Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: From hadi.hadizadeh at hotmail.com Fri Jan 10 20:26:15 2014 From: hadi.hadizadeh at hotmail.com (Hadi) Date: Fri, 10 Jan 2014 11:26:15 -0800 Subject: [Libav-user] Error in opening a SDP file using libavcodec Message-ID: Hi, I tried to open a SDP file using the following code using libavcodec: char *url = "foo.sdp"; AVFormatContext *oc = NULL; avformat_open_input(&oc, url, NULL , NULL); where the content of "foo.sdp" is as follows: v=0 o=- 0 0 IN IP4 127.0.0.1 s=No Name c=IN IP4 127.0.0.1 t=0 0 a=tool:libavformat 55.22.100 m=video 1234 RTP/AVP 96 b=AS:200 a=rtpmap:96 MP4V-ES/90000 a=fmtp:96 profile-level-id=1 but when I execute this code, I get the following error: [udp @ 0049e6e0] bind failed: Error number -10048 occurred Do you know what is the problem, and how I can solve it? Thanks! From hemiao_1990 at 126.com Sat Jan 11 03:38:18 2014 From: hemiao_1990 at 126.com (hemiao) Date: Sat, 11 Jan 2014 10:38:18 +0800 Subject: [Libav-user] swr_convert crashed when convert format S16P to FLTP In-Reply-To: <20140110082159.GL2655@barisone> References: <52CEBAC7.1000204@126.com> <20140110082159.GL2655@barisone> Message-ID: <52D0AE9A.8090001@126.com> I have checked ffmpeg and doc/examples/resampling.c, both of them works fine. I have reviewed my code many times, but unfortunatlly get no result. int AudioDecoder::doDecode() { AVPacket * packet = &mPacket; int decoded_size = 0; int got_frame = 0; int ret; if (!mFrame) { mFrame = av_frame_alloc(); } avcodec_get_frame_defaults(mFrame); while (1) { if (mPacketSize > 0) { ret = avcodec_decode_audio4(mCodecCtx, mFrame, &got_frame, packet); if (ret < 0) { fprintf(stderr, "decode audio failed: %s.\n", av_err2str(ret)); continue; } if (!got_frame) { mPacketSize = 0; continue; } mPacketSize -= ret; decoded_size = av_samples_get_buffer_size(NULL, mCodecCtx->channels, mFrame->nb_samples, (enum AVSampleFormat)mFrame->format, 1); if (mChannelLayout != mOutChannelLayout || mSampleFmt != mOutSampleFmt || mSampleRate != mOutSampleRate) { if (!mSwrCtx) { mSwrCtx = swr_alloc_set_opts(mSwrCtx, mOutChannelLayout /* 3 */, mOutSampleFmt /* fltp */, mOutSampleRate /* 44100 */, mChannelLayout /* 3 */, mSampleFmt /*s16p */, mSampleRate /* 44100 */, 0, NULL); int err = swr_init(mSwrCtx); if (err < 0) { av_log(NULL, AV_LOG_ERROR, "swr init failed: %s.\n", av_err2str(err)); exit(1); } } uint8_t * out[] = { mData }; int out_count = sizeof(mData) / av_get_channel_layout_nb_channels(mOutChannelLayout) / av_get_bytes_per_sample(mSampleFmt); ret = swr_convert(mSwrCtx, out, out_count, (const uint8_t **)mFrame->extended_data, mFrame->nb_samples); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "swr convert failed: %s.\n", av_err2str(ret)); exit(1); } decoded_size = ret * av_get_channel_layout_nb_channels(mOutChannelLayout) * av_get_bytes_per_sample(mOutSampleFmt); mAudioBuffer = mData; if (ret == out_count) { av_log(NULL, AV_LOG_INFO, "audio buffer too small.\n"); } } else { mAudioBuffer = mFrame->data[0]; } return decoded_size; } if (packet->data) { av_free_packet(packet); } ret = av_read_frame(mFmtCtx, packet); if (ret < 0) { fprintf(stdout, "read packet failed: %s.\n", av_err2str(ret)); } if (packet->stream_index != mStreamIndex) { continue; } mPacketSize += packet->size; } return -1; //shouldn't be here } > On date Thursday 2014-01-09 23:05:43 +0800, hemiao encoded: >> hi,everyone >> >> my audio source file's format is s16p. when i use swr_convert function >> to convert it to fltp or dblp, the function crashed, without return >> value or error message. >> but when i convert it to flt or dbl, it works fine. so why? > Please open a ticket if you're able to consistently reproduce the > error. Are you able to reproduce the issue with ffmpeg or with > doc/examples/resampling.c? From hemiao_1990 at 126.com Sat Jan 11 10:15:32 2014 From: hemiao_1990 at 126.com (hemiao) Date: Sat, 11 Jan 2014 17:15:32 +0800 Subject: [Libav-user] swr_convert crashed when convert format S16P to FLTP In-Reply-To: <52D0AE9A.8090001@126.com> References: <52CEBAC7.1000204@126.com> <20140110082159.GL2655@barisone> <52D0AE9A.8090001@126.com> Message-ID: <52D10BB4.2050908@126.com> I think i got the reason. I converts the audio to planar format, but frame->data[1] is NULL. > I have checked ffmpeg and doc/examples/resampling.c, both of them > works fine. I have reviewed my code many times, but unfortunatlly get > no result. > > int AudioDecoder::doDecode() > { > AVPacket * packet = &mPacket; > int decoded_size = 0; > int got_frame = 0; > int ret; > > if (!mFrame) { > mFrame = av_frame_alloc(); > } > > avcodec_get_frame_defaults(mFrame); > while (1) { > if (mPacketSize > 0) { > ret = avcodec_decode_audio4(mCodecCtx, mFrame, &got_frame, > packet); > if (ret < 0) { > fprintf(stderr, "decode audio failed: %s.\n", > av_err2str(ret)); > continue; > } > > if (!got_frame) { > mPacketSize = 0; > continue; > } > > mPacketSize -= ret; > decoded_size = av_samples_get_buffer_size(NULL, > mCodecCtx->channels, > mFrame->nb_samples, (enum > AVSampleFormat)mFrame->format, 1); > if (mChannelLayout != mOutChannelLayout || > mSampleFmt != mOutSampleFmt || > mSampleRate != mOutSampleRate) > { > if (!mSwrCtx) { > mSwrCtx = swr_alloc_set_opts(mSwrCtx, > mOutChannelLayout /* 3 */, mOutSampleFmt /* fltp */, > mOutSampleRate /* 44100 */, mChannelLayout > /* 3 */, mSampleFmt /*s16p */, mSampleRate /* 44100 */, 0, NULL); > int err = swr_init(mSwrCtx); > if (err < 0) { > av_log(NULL, AV_LOG_ERROR, "swr init failed: > %s.\n", av_err2str(err)); > exit(1); > } > } > > uint8_t * out[] = { mData }; > int out_count = sizeof(mData) / > av_get_channel_layout_nb_channels(mOutChannelLayout) / > av_get_bytes_per_sample(mSampleFmt); > ret = swr_convert(mSwrCtx, out, out_count, (const > uint8_t **)mFrame->extended_data, > mFrame->nb_samples); > if (ret < 0) { > av_log(NULL, AV_LOG_ERROR, "swr convert failed: > %s.\n", av_err2str(ret)); > exit(1); > } > decoded_size = ret * > av_get_channel_layout_nb_channels(mOutChannelLayout) * > av_get_bytes_per_sample(mOutSampleFmt); > mAudioBuffer = mData; > if (ret == out_count) { > av_log(NULL, AV_LOG_INFO, "audio buffer too > small.\n"); > } > } else { > mAudioBuffer = mFrame->data[0]; > } > > return decoded_size; > } > > if (packet->data) { > av_free_packet(packet); > } > > ret = av_read_frame(mFmtCtx, packet); > if (ret < 0) { > fprintf(stdout, "read packet failed: %s.\n", > av_err2str(ret)); > } > if (packet->stream_index != mStreamIndex) { > continue; > } > mPacketSize += packet->size; > } > > return -1; //shouldn't be here > } > > >> On date Thursday 2014-01-09 23:05:43 +0800, hemiao encoded: >>> hi,everyone >>> >>> my audio source file's format is s16p. when i use swr_convert function >>> to convert it to fltp or dblp, the function crashed, without return >>> value or error message. >>> but when i convert it to flt or dbl, it works fine. so why? >> Please open a ticket if you're able to consistently reproduce the >> error. Are you able to reproduce the issue with ffmpeg or with >> doc/examples/resampling.c? > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From krueger at lesspain.de Sun Jan 12 16:49:05 2014 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Sun, 12 Jan 2014 16:49:05 +0100 Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? Message-ID: Hi, I am having problems programmatically extracting metadata like size and pixel format from a dpx image using a custom AVIOContext. Should that work or does the image2 demuxer only work with files even in the single-file case? Or is there something I need to watch out for when using it this way? In my case the call to avformat_open_input fails already. The same code generally works and has been used/tested with a lot of formats for a long time. It just seems to fail on formats that the command line tool opens with the image2 demuxer (I also tried jpg and png). Is this related to not having a file name and if so, is there a way to fix this? Thanks in advance, Robert From hadi.hadizadeh at hotmail.com Sun Jan 12 17:22:50 2014 From: hadi.hadizadeh at hotmail.com (Hadi) Date: Sun, 12 Jan 2014 08:22:50 -0800 Subject: [Libav-user] Check an address to see if there is any video stream on it or not Message-ID: I want to read a video stream from a UDP address using libavcodec functions. To do so, I use the following code: char *url = "udp://127.0.0.1:1000"; AVFormatContext *oc = NULL; avformat_open_input(&oc, url, NULL , NULL); If we run this code, then function "avformat_open_input" starts listening on the given UDP address, and it looks like the program is halted if there is no video stream at the given UDP address. Now, I want to write a code to first check the given UDP address quickly to see whether there is any data on it or not, if there is no data then the program should neglect running "avformat_open_input", otherwise it should run this function so that I can avoid the halting situation. Any idea how I can do this? Thanks! From grisme at yandex.ru Sun Jan 12 17:38:51 2014 From: grisme at yandex.ru (=?koi8-r?B?5dfHxc7JyiDnwdLJxtXMzMnO?=) Date: Sun, 12 Jan 2014 22:38:51 +0600 Subject: [Libav-user] Check an address to see if there is any video stream on it or not In-Reply-To: References: Message-ID: <20891389544731@web27h.yandex.ru> 12.01.2014, 22:23, "Hadi" : > I want to read a video stream from a UDP address using libavcodec functions. To do so, I use the following code: > > char *url = "udp://127.0.0.1:1000"; > AVFormatContext *oc = NULL; > avformat_open_input(&oc, url, NULL , NULL); > > If we run this code, then function "avformat_open_input" starts listening on the given UDP address, and it looks like the program is halted if there is no video stream at the given UDP address. > > Now, I want to write a code to first check the given UDP address quickly to see whether there is any data on it or not, if there is no data then the program should neglect running "avformat_open_input", otherwise it should run this function so that I can avoid the halting situation. > > Any idea how I can do this? Thanks! > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user use interrupt_callback function to "unblock" avformat_open_input(...); concept: time_t check_timestamp; static int interrupt_cb(void* inputdata) { time_t current_timestamp; current_timestamp = time(0) if (current_timestamp - check_timestamp >= 10) return true; // interrupt blocked function else return false; // NOT interrupt, wait more seconds... } ... oc = avformat_allocate_context(); oc->interrupt_callbacl = (AVIOInterruptCB){interrupt_cb, NULL}; checl_timestamp = time(0); if (avformat_open_input(&oc, url, NULL , NULL) < 0) { // error processing } something like that :) if avformat_open_input frezzes more than 10 seconds (in this example), interrupt_cb will break it execution. -- ? ?????????, ??????? ??????????. e-mail: grisme at yandex.ru jabber: joffadark at jabber.ufanet.ru ICQ : 387906261 From cehoyos at ag.or.at Sun Jan 12 18:09:30 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 12 Jan 2014 17:09:30 +0000 (UTC) Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? References: Message-ID: Robert Kr?ger writes: > I am having problems programmatically extracting metadata > like size and pixel format from a dpx image using a custom > AVIOContext. Should that work or does the image2 demuxer > only work with files even in the single-file case? Contrary to all other demuxers, there is no auto-detection for image2, so (without looking at the actual code, sorry if it actually works differently) you have to either set demuxer and decoder or demuxer and a file name suffix. Hope that helps, Carl Eugen From h.leppkes at gmail.com Sun Jan 12 18:15:41 2014 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Sun, 12 Jan 2014 18:15:41 +0100 Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? In-Reply-To: References: Message-ID: On Sun, Jan 12, 2014 at 4:49 PM, Robert Kr?ger wrote: > Hi, > > I am having problems programmatically extracting metadata like size > and pixel format from a dpx image using a custom AVIOContext. Should > that work or does the image2 demuxer only work with files even in the > single-file case? Or is there something I need to watch out for when > using it this way? > > In my case the call to avformat_open_input fails already. The same > code generally works and has been used/tested with a lot of formats > for a long time. It just seems to fail on formats that the command > line tool opens with the image2 demuxer (I also tried jpg and png). Is > this related to not having a file name and if so, is there a way to > fix this? > image2 requires to directly access the files itself. There is also a image2pipe, which can read the data from a avio context, but in my experience it also didn't work properly because its designed for a "pipe" scenario where it doesn't know the file size, and therefor reads kinda blindly. Now for custom IO that knows the size, but just wants to deliver the data through its own IO functions, neither seem to work properly as of today. - Hendrik From hadi.hadizadeh at hotmail.com Sun Jan 12 18:26:46 2014 From: hadi.hadizadeh at hotmail.com (Hadi) Date: Sun, 12 Jan 2014 09:26:46 -0800 Subject: [Libav-user] Check an address to see if there is any video stream on it or not In-Reply-To: <20891389544731@web27h.yandex.ru> References: , <20891389544731@web27h.yandex.ru> Message-ID: Thanks for the response, it works! :) I was thinking to put such a code within a thread. Whenever "avformat_open_input" finds a stream at the given address, then the thread can be terminated. In the meantime, the program can do other stuffs. But do you know how I can make a thread with libavcodec functions? ---------------------------------------- > From: grisme at yandex.ru > To: libav-user at ffmpeg.org > Date: Sun, 12 Jan 2014 22:38:51 +0600 > Subject: Re: [Libav-user] Check an address to see if there is any video stream on it or not > > > 12.01.2014, 22:23, "Hadi" : >> I want to read a video stream from a UDP address using libavcodec functions. To do so, I use the following code: >> >> char *url = "udp://127.0.0.1:1000"; >> AVFormatContext *oc = NULL; >> avformat_open_input(&oc, url, NULL , NULL); >> >> If we run this code, then function "avformat_open_input" starts listening on the given UDP address, and it looks like the program is halted if there is no video stream at the given UDP address. >> >> Now, I want to write a code to first check the given UDP address quickly to see whether there is any data on it or not, if there is no data then the program should neglect running "avformat_open_input", otherwise it should run this function so that I can avoid the halting situation. >> >> Any idea how I can do this? Thanks! >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user > > use interrupt_callback function to "unblock" avformat_open_input(...); > concept: > > time_t check_timestamp; > > static int interrupt_cb(void* inputdata) > { > time_t current_timestamp; > current_timestamp = time(0) > if (current_timestamp - check_timestamp>= 10) > return true; // interrupt blocked function > else > return false; // NOT interrupt, wait more seconds... > } > ... > oc = avformat_allocate_context(); > oc->interrupt_callbacl = (AVIOInterruptCB){interrupt_cb, NULL}; > checl_timestamp = time(0); > if (avformat_open_input(&oc, url, NULL , NULL) < 0) > { > // error processing > } > > something like that :) if avformat_open_input frezzes more than 10 seconds (in this example), interrupt_cb will break it execution. > > -- > ? ?????????, ??????? ??????????. > e-mail: grisme at yandex.ru > jabber: joffadark at jabber.ufanet.ru > ICQ : 387906261 > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From hadi.hadizadeh at hotmail.com Sun Jan 12 18:24:36 2014 From: hadi.hadizadeh at hotmail.com (redhat_doom) Date: Sun, 12 Jan 2014 09:24:36 -0800 (PST) Subject: [Libav-user] Check an address to see if there is any video stream on it or not In-Reply-To: <20891389544731@web27h.yandex.ru> References: <20891389544731@web27h.yandex.ru> Message-ID: <1389547476798-4659119.post@n4.nabble.com> Thanks for the response, it works! :) I was thinking to put such a code within a thread. Whenever "avformat_open_input" finds a stream at the given address, then the thread can be terminated. In the meantime, the program can do other stuffs. But do you know how I can make a thread with libavcodec functions? -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Check-an-address-to-see-if-there-is-any-video-stream-on-it-or-not-tp4659115p4659119.html Sent from the libav-users mailing list archive at Nabble.com. From marcelopaesrech at gmail.com Sun Jan 12 13:48:25 2014 From: marcelopaesrech at gmail.com (Marcelo Paes Rech) Date: Sun, 12 Jan 2014 10:48:25 -0200 Subject: [Libav-user] ffmpeg on android Message-ID: Hi guys, I am trying to do a stream player in android but I need to read a array of bytes and then decode every packet of array of bytes. In the end started to make my AAC decoder work with the ffmpeg example of decoder. But I ran into the same problem of this guy: http://stackoverflow.com/questions/13499480/decode-aac-to-pcm-with-ffmpeg-on-android But the decoder does not work. I am receiving a error as follows: TNS filter order %d is greater than maximum %d. Error while decoding: -1 If I use the ffmpeg to decode it works fine. ffmpeg -i audio.mp4 audio.wav Environment: ffmpeg 1.2 Android ndkr9b Follows my source code: AVCodec *codec; AVCodecContext *c= NULL; int len; FILE *f, *outfile; uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; AVPacket avpkt; AVFrame *decoded_frame = NULL; av_log_set_callback(&my_ffmpeg_log); av_init_packet(&avpkt); printf("Decode audio file %s to %s\n", filename, outfilename); /* find the mpeg audio decoder */ codec = avcodec_find_decoder(AV_CODEC_ID_AAC); if (!codec) { LOGV("Codec not found\n"); return; } c = avcodec_alloc_context3(codec); c->channels = 2; c->sample_rate = 48000; if (!c) { LOGV("Could not allocate audio codec context\n"); return; } /* open it */ if (avcodec_open2(c, codec, NULL) < 0) { LOGV("Could not open codec\n"); return; } f = fopen(filename, "rb"); if (!f) { LOGV("Could not open %s\n", filename); return; } outfile = fopen(outfilename, "wb"); if (!outfile) { av_free(c); return; } /* decode until eof */ avpkt.data = inbuf; avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f); while (avpkt.size > 0) { int got_frame = 0; if (!decoded_frame) { if (!(decoded_frame = avcodec_alloc_frame())) { LOGV("Could not allocate audio frame\n"); return; } } else avcodec_get_frame_defaults(decoded_frame); len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); if (len < 0) { LOGV("Error while decoding: %d\n", len); return; } if (got_frame) { /* if a frame has been decoded, output it */ int data_size = av_samples_get_buffer_size(NULL, c->channels, decoded_frame->nb_samples, c->sample_fmt, 1); fwrite(decoded_frame->data[0], 1, data_size, outfile); } avpkt.size -= len; avpkt.data += len; avpkt.dts = avpkt.pts = AV_NOPTS_VALUE; if (avpkt.size < AUDIO_REFILL_THRESH) { /* Refill the input buffer, to avoid trying to decode * incomplete frames. Instead of this, one could also use * a parser, or use a proper container format through * libavformat. */ memmove(inbuf, avpkt.data, avpkt.size); avpkt.data = inbuf; len = fread(avpkt.data + avpkt.size, 1, AUDIO_INBUF_SIZE - avpkt.size, f); if (len > 0) avpkt.size += len; } } fclose(outfile); fclose(f); avcodec_close(c); av_free(c); avcodec_free_frame(&decoded_frame); -- *Atenciosamente, Marcelo Paes Rech.* E-mail: marcelopaesrech at gmail.com Blog: http://marcelopaesrech.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sun Jan 12 20:02:01 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 12 Jan 2014 19:02:01 +0000 (UTC) Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? References: Message-ID: Hendrik Leppkes writes: > image2 requires to directly access the files itself. Thank you for correcting me! > There is also a image2pipe, which can read the data from a avio > context, but in my experience it also didn't work properly because its > designed for a "pipe" scenario where it doesn't know the file size, > and therefor reads kinda blindly. Could you elaborate a little on the shortcomings of image2pipe? I seem to remember that it is used often. Or do you just mean that too many parsers are missing? Carl Eugen From h.leppkes at gmail.com Sun Jan 12 20:21:39 2014 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Sun, 12 Jan 2014 20:21:39 +0100 Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? In-Reply-To: References: Message-ID: On Sun, Jan 12, 2014 at 8:02 PM, Carl Eugen Hoyos wrote: > Hendrik Leppkes writes: > >> image2 requires to directly access the files itself. > > Thank you for correcting me! > >> There is also a image2pipe, which can read the data from a avio >> context, but in my experience it also didn't work properly because its >> designed for a "pipe" scenario where it doesn't know the file size, >> and therefor reads kinda blindly. > > Could you elaborate a little on the shortcomings of image2pipe? > I seem to remember that it is used often. > Or do you just mean that too many parsers are missing? Yeah it only works on img formats which have a parser to re-assemble full images, so its use is a bit limited. On the other hand, you can actually use it to pipe several images in one command into it (if you have a parser), so both use-cases can be useful i suppose. - Hendrik From cehoyos at ag.or.at Sun Jan 12 20:47:41 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 12 Jan 2014 19:47:41 +0000 (UTC) Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? References: Message-ID: Hendrik Leppkes writes: > Yeah it only works on img formats which have a > parser to re-assemble full images, so its use is > a bit limited. Note that I (?) implemented -frame_size for image formats with constant frame size. Carl Eugen From sylviojalves at gmail.com Mon Jan 13 00:56:41 2014 From: sylviojalves at gmail.com (=?ISO-8859-1?Q?Sylvio_Jos=E9_Alves_Neto?=) Date: Sun, 12 Jan 2014 21:56:41 -0200 Subject: [Libav-user] ffmpeg on android In-Reply-To: References: Message-ID: Marcelo, have you initialized the ffmpeg using av_register_all()? Also, when building the ffmpeg, have you included encoding/decoding/ parsing support for aac? Sylvio Em 12/01/2014 16:18, "Marcelo Paes Rech" escreveu: > Hi guys, > > I am trying to do a stream player in android but I need to read a array of > bytes and then decode every packet of array of bytes. In the end started to > make my AAC decoder work with the ffmpeg example of decoder. But I ran into > the same problem of this guy: > > > http://stackoverflow.com/questions/13499480/decode-aac-to-pcm-with-ffmpeg-on-android > > But the decoder does not work. I am receiving a error as follows: > > TNS filter order %d is greater than maximum %d. > Error while decoding: -1 > > If I use the ffmpeg to decode it works fine. > > ffmpeg -i audio.mp4 audio.wav > > Environment: > ffmpeg 1.2 > Android ndkr9b > > Follows my source code: > > AVCodec *codec; > > AVCodecContext *c= NULL; > > int len; > > FILE *f, *outfile; > > uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; > > AVPacket avpkt; > > AVFrame *decoded_frame = NULL; > > av_log_set_callback(&my_ffmpeg_log); > > av_init_packet(&avpkt); > > > printf("Decode audio file %s to %s\n", filename, outfilename); > > > /* find the mpeg audio decoder */ > > codec = avcodec_find_decoder(AV_CODEC_ID_AAC); > > if (!codec) { > > LOGV("Codec not found\n"); > > return; > > } > > > c = avcodec_alloc_context3(codec); > > c->channels = 2; > > c->sample_rate = 48000; > > > if (!c) { > > LOGV("Could not allocate audio codec context\n"); > > return; > > } > > > /* open it */ > > if (avcodec_open2(c, codec, NULL) < 0) { > > LOGV("Could not open codec\n"); > > return; > > } > > > f = fopen(filename, "rb"); > > if (!f) { > > LOGV("Could not open %s\n", filename); > > return; > > } > > outfile = fopen(outfilename, "wb"); > > if (!outfile) { > > av_free(c); > > return; > > } > > > /* decode until eof */ > > avpkt.data = inbuf; > > avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f); > > > while (avpkt.size > 0) { > > int got_frame = 0; > > > if (!decoded_frame) { > > if (!(decoded_frame = avcodec_alloc_frame())) { > > LOGV("Could not allocate audio frame\n"); > > return; > > } > > } else > > avcodec_get_frame_defaults(decoded_frame); > > > len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); > > if (len < 0) { > > LOGV("Error while decoding: %d\n", len); > > return; > > } > > if (got_frame) { > > /* if a frame has been decoded, output it */ > > int data_size = av_samples_get_buffer_size(NULL, c->channels, > > > decoded_frame->nb_samples, > > c->sample_fmt, 1); > > fwrite(decoded_frame->data[0], 1, data_size, outfile); > > } > > avpkt.size -= len; > > avpkt.data += len; > > avpkt.dts = > > avpkt.pts = AV_NOPTS_VALUE; > > if (avpkt.size < AUDIO_REFILL_THRESH) { > > /* Refill the input buffer, to avoid trying to decode > > * incomplete frames. Instead of this, one could also use > > * a parser, or use a proper container format through > > * libavformat. */ > > memmove(inbuf, avpkt.data, avpkt.size); > > avpkt.data = inbuf; > > len = fread(avpkt.data + avpkt.size, 1, > > AUDIO_INBUF_SIZE - avpkt.size, f); > > if (len > 0) > > avpkt.size += len; > > } > > } > > > fclose(outfile); > > fclose(f); > > > avcodec_close(c); > > av_free(c); > > avcodec_free_frame(&decoded_frame); > > -- > *Atenciosamente, Marcelo Paes Rech.* > E-mail: marcelopaesrech at gmail.com > Blog: http://marcelopaesrech.blogspot.com > > > _______________________________________________ > 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 krueger at lesspain.de Mon Jan 13 10:39:10 2014 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Mon, 13 Jan 2014 10:39:10 +0100 Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? In-Reply-To: References: Message-ID: On Sun, Jan 12, 2014 at 8:21 PM, Hendrik Leppkes wrote: > On Sun, Jan 12, 2014 at 8:02 PM, Carl Eugen Hoyos wrote: >> Hendrik Leppkes writes: >> >>> image2 requires to directly access the files itself. >> >> Thank you for correcting me! >> >>> There is also a image2pipe, which can read the data from a avio >>> context, but in my experience it also didn't work properly because its >>> designed for a "pipe" scenario where it doesn't know the file size, >>> and therefor reads kinda blindly. >> >> Could you elaborate a little on the shortcomings of image2pipe? >> I seem to remember that it is used often. >> Or do you just mean that too many parsers are missing? > > Yeah it only works on img formats which have a parser to re-assemble > full images, so its use is a bit limited. > On the other hand, you can actually use it to pipe several images in > one command into it (if you have a parser), so both use-cases can be > useful i suppose. Could you elaborate a bit what would be needed to make this work, i.e. demuxing single images (not a series) like jpg, png, dpx and probably others covered by the image2 demuxer with a custom AVIOContext that has a size and in my case can also seek but without access to the file? From cehoyos at ag.or.at Mon Jan 13 11:57:50 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 13 Jan 2014 10:57:50 +0000 (UTC) Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? References: Message-ID: Robert Kr?ger writes: > Could you elaborate a bit what would be needed to make > this work, i.e. demuxing single images (not a series) > like jpg, png, dpx jpg and png and dpx should work fine with image2pipe > and probably others covered by the image2 demuxer Which others? Some will have constant frame size, for the rest a parser would be needed. Carl Eugen From krueger at lesspain.de Mon Jan 13 15:53:30 2014 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Mon, 13 Jan 2014 15:53:30 +0100 Subject: [Libav-user] Does the image2 demuxer work with a custom AVIOContext? In-Reply-To: References: Message-ID: On Mon, Jan 13, 2014 at 11:57 AM, Carl Eugen Hoyos wrote: > Robert Kr?ger writes: > >> Could you elaborate a bit what would be needed to make >> this work, i.e. demuxing single images (not a series) >> like jpg, png, dpx > > jpg and png and dpx should work fine with image2pipe OK, so just to avoid misunderstandings: What I would have to do is to first determine the file type myself (e.g. by file extension) and if it is one that should use the image2pipe demuxer (for simplicity's sake let's say that's jpg, png and dpx) I obtain an instance of AVInputFormat (using av_find_input_format) for image2pipe and then call avformat_open_input using that input format pointer. Is that correct? > >> and probably others covered by the image2 demuxer > > Which others? > Some will have constant frame size, for the rest a > parser would be needed. > > Carl Eugen > Thank you, Robert From mayank77fromindia at gmail.com Mon Jan 13 13:31:50 2014 From: mayank77fromindia at gmail.com (Mayank Agarwal) Date: Mon, 13 Jan 2014 18:01:50 +0530 Subject: [Libav-user] Doubts in ffmpeg Message-ID: Hi, I am trying to understand mp4 file and ts demuxing/decoding and has following doubts.Please help me clarify. Hi, i have the following doubts in ffmpeg.Please clarify 1.I am reading mp4 file using ffmpeg and after doing av_read_frame i am getting video(stream_index = 0),audio(stream_index = 1) packets First there is no order of coming of video/audio packets.Is it the standard case. 2.Video pgackets are coming of various sizes from the minimum of 14 to the maximum of 21824.Please point why the video packet size varies,somewhere it is written that for video one packet means one frame,so if for video pkt->size = 14 also equals one frame of video.(pkt is of type AVPacket). 3.If we demux the incoming mp4 stream in Probe function while parsing it and store the info in some buffer or calling av_read_frame demuxes it. 4.Is it possible in ffmpeg to demux the mp4 file and then assign both a/v in one stream of packets where video packet has stream_index = 1,and for audio = 0. or it has to be in separate stream. 5.Diff between ffmpeg processing for transport stream and mp4 file. if both are demuxed,decoded in same way or is it different. 6.Please point me any example to add subtitle to the mp4 file in ffmpeg. Regards Mayank -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at enciris.com Tue Jan 14 15:39:53 2014 From: mc at enciris.com (Malik Cisse) Date: Tue, 14 Jan 2014 14:39:53 +0000 Subject: [Libav-user] H.264 annex B muxing in mp4 Message-ID: Hi, I managed to write a H.264 annex B muxer (from a compression board) in mp4 using libavformat. If I don't specify extradata as bellow, the generated MP4 stream appears to be corrupted and won't play in quicktime. pMux_ctx->video_st = NULL; if ( pMux_ctx->fmt->video_codec != CODEC_ID_NONE ) { AVCodecContext * c; pMux_ctx->video_st = av_new_stream (pMux_ctx->oc , 0); if (! pMux_ctx->video_st) { fprintf( stderr, "Could not alloc video_stream\n" ); exit(1); } c = pMux_ctx->video_st->codec; ... c->extradata = buffer; c->extradata_size = size; ... } This all works fine but I just don't understand why the muxer needs the extradata since all necessary metadata have already been set through AVCodecContext. I would like to simplify the code and avoid computing extradata in advance (saving thus 600 lines of code). Thanks, Malikcis -------------- next part -------------- An HTML attachment was scrubbed... URL: From mayank77fromindia at gmail.com Tue Jan 14 14:35:48 2014 From: mayank77fromindia at gmail.com (Mayank Agarwal) Date: Tue, 14 Jan 2014 19:05:48 +0530 Subject: [Libav-user] Allocate packet data from AVFormatContext to pkt in AVPacket Message-ID: Hi, Please get me some info where in the ffmpeg we are passing AVFormatContext pointer as input and getting actual file data in AVPacket pointer type packet. Regards Mayank -------------- next part -------------- An HTML attachment was scrubbed... URL: From mayank77fromindia at gmail.com Tue Jan 14 23:03:58 2014 From: mayank77fromindia at gmail.com (Mayank Agarwal) Date: Wed, 15 Jan 2014 03:33:58 +0530 Subject: [Libav-user] Understand read_frame_internal Message-ID: Hi, I am trying to understand parsing in ffmpeg. Please help me clear the following doubts: 1.In read_frame_internal there is if loop like this: st = s->cur_st; if (st) { where it gets current stream pointer Please clarify if it goes in this if loop or else loop where it calls av_read_packet ? 2.Also in if loop if(!st->need_parsing || !st->parser) it checks for these flags ande calls av_add_index_entry where these flags(need_parsing,etc) are set/reset ? 3.Also if it is av_read_packet function where the actual data is getting transferred from AVFormatContext *s to AVPacket *pkt or is there any other function? I am asking all these questions if i am taking simple mp4 file probing/parsing,demuxing,decoding and playing it. Please pardon me if i am answering very basic. Also if there is any documentation about functions/headers used in ffmpeg? Regards, Mayank -------------- next part -------------- An HTML attachment was scrubbed... URL: From grecd at yandex.ru Wed Jan 15 09:41:21 2014 From: grecd at yandex.ru (Michail Zhukov) Date: Wed, 15 Jan 2014 12:41:21 +0400 Subject: [Libav-user] AVFrame uint32* mb_type is 0x0 Message-ID: <410241389775281@web15j.yandex.ru> I am trying to use deprecated (WHY?) attributes of AVFrame in FFMPEG. i use pCodecCtx->debug_mv = FF_DEBUG_MV I need to know macroblock type, motion value. What is the best way nowadays? Suddenly mb_type adress is always 0x0; From mayank77fromindia at gmail.com Wed Jan 15 00:37:26 2014 From: mayank77fromindia at gmail.com (Mayank Agarwal) Date: Wed, 15 Jan 2014 05:07:26 +0530 Subject: [Libav-user] Demuxing mp4 file in ffmpeg Message-ID: Hi, I am trying to understand the demuxing o mp4code of mp4 file in ffmpeg. I have the following doubts. 1.There is no ff_mp4_demuxer for mp4 demuxing so how the functions like read_packet,read_header which are there in vtable for other demuxers(like avi/asf) are called in mp4 case. 2.Please help me in understanding read_frame_internal. wher it is copying the file data to AVPacket *pkt. 3.Also in mp4 file case where it is assigning s->iFormat->name to mp4 so that appropriate demuxer functions can be called 4.Also if for mp4 it is calling mpegts demux functions. Thanks for your help. Regards, Mayank -------------- next part -------------- An HTML attachment was scrubbed... URL: From mtaha.ansari at gmail.com Thu Jan 16 12:14:23 2014 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Thu, 16 Jan 2014 16:14:23 +0500 Subject: [Libav-user] Transcoding to vorbis Message-ID: Hi! I have made a test application to transcode to vorbis format (webm container). So far, based on FFmpeg examples, things are somewhat working, and output file plays properly, but sound in right channel is missing. I tried looking at different possibilities, but so far could not find any answer. For reference, this is the code I am using: https://gist.github.com/anonymous/a3ac583194050081f5bc Working under Windows 7, Zeranoe FFmpeg 32 bit build: libavutil 52. 62.100 / 52. 62.100 libavcodec 55. 47.101 / 55. 47.101 libavformat 55. 22.103 / 55. 22.103 libavdevice 55. 5.102 / 55. 5.102 libavfilter 4. 1.100 / 4. 1.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Input file "test.mp2", is attached as well. Could anyone point to the place where I might be misunderstanding things? Thanks in advance for your time... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.mp2 Type: audio/mpeg Size: 38400 bytes Desc: not available URL: From dhenry at movenetworks.com Thu Jan 16 19:10:25 2014 From: dhenry at movenetworks.com (David Henry) Date: Thu, 16 Jan 2014 11:10:25 -0700 Subject: [Libav-user] trying to add scte-35 demuxer/decoder Message-ID: I am trying to add a way to detect and parse scte-35 messages in a mpeg udp multi-program transport stream. /opt/move/ffmpeg/bin/ffmpeg -loglevel debug -i udp://x.x.x.x:x ? Input #0, mpegts, from 'udp://x.x.x.x:x': Program 1 Stream #0:10[0x80f], 36, 1/90000: Id=2 video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1001/120000, 20000 kb/s, 92.67 fps, 59.94 tbr, 90k tbn, 119.88 tbc Stream #0:11[0x80e](eng), 19, 1/90000: Id=86019 audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), s16, 384 kb/s Stream #0:12[0x80d](spa), 18, 1/90000: Id=86019 audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, s16, 192 kb/s Stream #0:13[0x80c], 0, 1/90000: Id=98305 data: scte-35 ([134][0][0][0] / 0x0086) I added a codec in libavcodec which will eventually parse the packets, but currently does nothing. I am setting the data_codec_id in my calling application, which I have added to AVFormatContext (see below). I have looked at the following pages for guidance: http://wiki.multimedia.cx/index.php?title=FFmpeg_demuxer_howto http://wiki.multimedia.cx/index.php?title=FFmpeg_codec_HOWTO#libavcodec.2Favcodec.h But it seems I am not really writing a "demuxer", because I will just be piggybacking on the libavformat/mpegts.c demuxer, right? My question is this: What is the next step to be able to capture packets/messages out of stream #0:13 (see above) And pass those packets to the codec I have defined in libavcodec? Where does this occur in the code? Thanks, David These are the changes I have made in libavformat/ : diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f2b4317..6a740d6 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1018,6 +1018,7 @@ typedef struct AVFormatContext { */ enum CodecID subtitle_codec_id; + enum CodecID data_codec_id; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 7935048..0c5bbea 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -560,6 +560,7 @@ static const StreamType HDMV_types[] = { static const StreamType MISC_types[] = { { 0x81, AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 }, { 0x8a, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS }, + { 0x86, AVMEDIA_TYPE_DATA, CODEC_ID_SCTE }, { 0 }, }; diff --git a/libavformat/utils.c b/libavformat/utils.c index 4817507..7ad59ac 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -805,6 +805,9 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt) case AVMEDIA_TYPE_SUBTITLE: if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id; break; + case AVMEDIA_TYPE_DATA: + if(s->data_codec_id)st->codec->codec_id= s->data_codec_id; + break; } -------------- next part -------------- An HTML attachment was scrubbed... URL: From gheorghitacristian at mac.com Wed Jan 15 23:57:40 2014 From: gheorghitacristian at mac.com (mastereve) Date: Wed, 15 Jan 2014 14:57:40 -0800 (PST) Subject: [Libav-user] Simple demux and copy codec In-Reply-To: References: Message-ID: <1389826660679-4659135.post@n4.nabble.com> Hey, nice work! I am trying also to mimic that command but got lost in the ffmpeg.c code. If you can share the whole demuxing code I will much appreciate it :) -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Simple-demux-and-copy-codec-tp4656117p4659135.html Sent from the libav-users mailing list archive at Nabble.com. From lkm9125 at gmail.com Thu Jan 16 11:58:48 2014 From: lkm9125 at gmail.com (funta) Date: Thu, 16 Jan 2014 02:58:48 -0800 (PST) Subject: [Libav-user] Inaccurate duration and play speed from calculating PTS while AAC encoding Message-ID: <1389869928123-4659136.post@n4.nabble.com> I'm trying to make AAC encoder for various audio format (FLAC, MP3, AAC, AC3 on my purpose) It could be worked with video or audio source file I used this formula in PTS calculation ============================ (int)((double)audio_samples * ((out_acodec->time_base.den / out_acodec->time_base.num) / samplerate)); ============================ But, some file makes inaccurate duration and play speed Duration, could be longer than original duration Play speed, It doesn't mean physical music speed(result file has always maintain 1X. well encoded), does mean unactual sec. time speed, also progressive(elapsed time) value speed on video player I've tested with several files, results are below (INPUT FILE => OUTPUT FILE) FLAC(S16) 04:00 => AAC(S16) 04:00 [correct] FLAC(S16) 04:51 => AAC(S16) 04:51 [correct] FLAC(S16) 24:35 => AAC(S16) 24:35 [correct] *FLAC(S16) 01:38 => AAC(S16) 01:47 [incorrect]* MP3(S16P) 03:03 => AAC(S16) 03:03 [correct] MP3(S16P) 03:35 => AAC(S16) 03:35 [correct] MP3(S16P) 03:36 => AAC(S16) 03:36 [correct] H264/AAC(FLTP) 00:41 => AAC(S16) 00:41 [correct] H264/AAC(FLTP) 02:03 => AAC(S16) 02:03 [correct] H264/AAC(FLTP) 04:40 => AAC(S16) 04:40 [correct] H264/AAC(FLTP) 06:46 => AAC(S16) 06:46 [correct] *H264/AC3(FLTP) 05:00 => AAC(S16) 05:26 [incorrect]* *H264/AC3(FLTP) 10:58 => AAC(S16) 11:56 [incorrect]* XVID/MP3(S16P) 03:21 => AAC(S16) 03:21 [correct] *XVID/MP3(S16P) 04:05 => AAC(S16) 04:27 [incorrect]* I didn't receive any error message while encoding. My encoder has worked properly I think the PTS formula has this issue Am I missing something? Here is main loop ============================== // for PTS int audio_samples = 0; double samplerate = out_acodec->sample_rate; while(1) { ... if(pkt.stream_index == in_astream->index) { ... ret = avcodec_decode_audio4(in_acodec, in_frame, &got_frame, &pkt); if(got_frame) { ... // I'm using FIFO, Swresample in this loop while(av_fifo_size(fifo) >= frame_bytes) { ... av_init_packet(&newpkt); // calculating PTS(what is wrong?) out_frame->pts = (int)((double)audio_samples * ((out_acodec->time_base.den / out_acodec->time_base.num) / samplerate)); avcodec_encode_audio2(out_acodec, &newpkt, out_frame, &got_packet); if(got_packet) { newpkt.stream_index = out_astream->index; newpkt.flags |= AV_PKT_FLAG_KEY; av_interleaved_write_frame(out, &newpkt); av_free_packet(&newpkt); } ... audio_samples += out_frame->nb_samples; } ... } } ... } ============================== -- View this message in context: http://libav-users.943685.n4.nabble.com/Inaccurate-duration-and-play-speed-from-calculating-PTS-while-AAC-encoding-tp4659136.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Thu Jan 16 20:28:38 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 16 Jan 2014 19:28:38 +0000 (UTC) Subject: [Libav-user] trying to add scte-35 demuxer/decoder References: Message-ID: David Henry writes: > { 0x8a, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS }, > + ? ?{ 0x86, AVMEDIA_TYPE_DATA, CODEC_ID_SCTE }, This looks very outdated, are you sure that you are developing with current git head? Everything else makes no sense. I may misunderstand your questions but afaict, you have to add a codec id, add some logic to the demuxer (as above) and add a decoder. The decoder will then receive packets from the demuxer. Carl Eugen From stefasab at gmail.com Thu Jan 16 20:52:04 2014 From: stefasab at gmail.com (Stefano Sabatini) Date: Thu, 16 Jan 2014 20:52:04 +0100 Subject: [Libav-user] Simple demux and copy codec In-Reply-To: <1389826660679-4659135.post@n4.nabble.com> References: <1389826660679-4659135.post@n4.nabble.com> Message-ID: <20140116195204.GG21823@barisone> In data Wednesday 2014-01-15 14:57:40 -0800, mastereve ha scritto: > Hey, nice work! I am trying also to mimic that command but got lost in the > ffmpeg.c code. If you can share the whole demuxing code I will much > appreciate it :) See example in attachment. If there is enough interest I could add it to doc/examples. -------------- next part -------------- A non-text attachment was scrubbed... Name: remuxing.c Type: text/x-csrc Size: 5519 bytes Desc: not available URL: From dhenry at movenetworks.com Thu Jan 16 21:17:27 2014 From: dhenry at movenetworks.com (David Henry) Date: Thu, 16 Jan 2014 13:17:27 -0700 Subject: [Libav-user] trying to add scte-35 demuxer/decoder In-Reply-To: References: Message-ID: On 1/16/14 12:28 PM, "Carl Eugen Hoyos" wrote: >David Henry writes: > >> { 0x8a, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS }, >> + { 0x86, AVMEDIA_TYPE_DATA, CODEC_ID_SCTE }, > >This looks very outdated, are you sure that you are >developing with current git head? >Everything else makes no sense. > >I may misunderstand your questions but afaict, you >have to add a codec id, add some logic to the >demuxer (as above) and add a decoder. The decoder >will then receive packets from the demuxer. > >Carl Eugen Sorry, I forgot to mention that I'm using the 0.9 branch. Long story. When you say add a decoder, do you mean in libavformat? The demuxer I Am using is mpegts.c, so it will call the decoder I define through the AVInputFormat interface? Using read_header() and read_packet()? From dhenry at movenetworks.com Thu Jan 16 21:36:33 2014 From: dhenry at movenetworks.com (David Henry) Date: Thu, 16 Jan 2014 13:36:33 -0700 Subject: [Libav-user] trying to add scte-35 demuxer/decoder In-Reply-To: References: Message-ID: On 1/16/14 1:17 PM, "David Henry" wrote: > >On 1/16/14 12:28 PM, "Carl Eugen Hoyos" wrote: > >>David Henry writes: >> >>> { 0x8a, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS }, >>> + { 0x86, AVMEDIA_TYPE_DATA, CODEC_ID_SCTE }, >> >>This looks very outdated, are you sure that you are >>developing with current git head? >>Everything else makes no sense. >> >>I may misunderstand your questions but afaict, you >>have to add a codec id, add some logic to the >>demuxer (as above) and add a decoder. The decoder >>will then receive packets from the demuxer. >> >>Carl Eugen > >Sorry, I forgot to mention that I'm using the 0.9 branch. Long story. >When you say add a decoder, do you mean in libavformat? The demuxer I >Am using is mpegts.c, so it will call the decoder I define through the >AVInputFormat interface? Using read_header() and read_packet()? Strike that last question - It seems you mean add a decoder in libavcodec, With init(), decode(), and close() functions defined in the AVCodec interface. What I don't see is where the muxer (mpegts in this case) calls the codec.decode() function. How/where does that take place? From vinvinod at gmail.com Fri Jan 17 08:36:03 2014 From: vinvinod at gmail.com (=?UTF-8?B?4LK14LK/4LKo4LOL4LKm4LONIFZpbm9kIEggSQ==?=) Date: Fri, 17 Jan 2014 13:06:03 +0530 Subject: [Libav-user] save video file over http Message-ID: Hi, I have a requirement that I need to save the converted video file to a server. Now I am saving the output of ffmpeg to a local file first and transferring it to the server via http post request using a different library. Can I do that via ffmpeg itself? like " ffmpeg -i input.mp4 -acodec copy -vcodec copy http://my.server.com/uploads/video0025.mp4" Is this possible? -- Vinod -------------- next part -------------- An HTML attachment was scrubbed... URL: From mtaha.ansari at gmail.com Fri Jan 17 12:23:54 2014 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Fri, 17 Jan 2014 16:23:54 +0500 Subject: [Libav-user] Bytes per sample for different audio formats Message-ID: Hi, While investigation few issues with adopted audio trans-coding techniques, I discovered that call to av_get_bytes_per_sample() for AV_SAMPLE_FMT_S16 returns '2', and for AV_SAMPLE_FMT_FLTP returns '4'. What does that mean? Can someone pin-point to underlying technique? Many thanks in advance... -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Jan 17 16:42:25 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 17 Jan 2014 15:42:25 +0000 (UTC) Subject: [Libav-user] Bytes per sample for different audio formats References: Message-ID: Taha Ansari writes: > While investigation few issues with adopted audio > trans-coding techniques, I discovered that call to > av_get_bytes_per_sample() for AV_SAMPLE_FMT_S16 > returns '2', AV_SAMPLE_FMT_S16 -> 16 bit signed 16 bit == 2 bytes > and for AV_SAMPLE_FMT_FLTP returns '4'. AV_SAMPLE_FMT_FLTP -> float (in the C sense) float == 4 bytes Carl Eugen From gheorghitacristian at mac.com Thu Jan 16 21:39:27 2014 From: gheorghitacristian at mac.com (mastereve) Date: Thu, 16 Jan 2014 12:39:27 -0800 (PST) Subject: [Libav-user] Simple demux and copy codec In-Reply-To: <20140116195204.GG21823@barisone> References: <1389826660679-4659135.post@n4.nabble.com> <20140116195204.GG21823@barisone> Message-ID: <1389904767597-4659144.post@n4.nabble.com> Thank you very much! You should definitely add this code to the examples as it's showcasing very well how the av calls can be used for such tasks. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Simple-demux-and-copy-codec-tp4656117p4659144.html Sent from the libav-users mailing list archive at Nabble.com. From lkm9125 at gmail.com Fri Jan 17 06:24:54 2014 From: lkm9125 at gmail.com (funta) Date: Thu, 16 Jan 2014 21:24:54 -0800 (PST) Subject: [Libav-user] Is there a way to encoding PCM to AAC? Message-ID: <1389936294239-4659145.post@n4.nabble.com> I made AAC encoder(with MP4 container) SWResample lib is used for audio resampling It has worked well other format(AC3, MP2, MP3, AAC, FLAC) But, I got failed on which it has PCM coded audio The error has occured at SWResample I've tested with several PCM coded(pcm_s16le) video/audio files though, Results are always same =================================== *[SWR @ 0x21f9120] Input channel count and layout are unset* Input #0, avi, from 'test.avi': Metadata: TCOD : 0 TCDO : 3125789333 Duration: 00:05:12.58, start: 0.000000, bitrate: 4424 kb/s Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p, 624x352 [SAR 1:1 DAR 39:22], 29.97 fps, 29.97 tbr, 29.97 tbn, 59.94 tbc Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s =================================== Output #0, mp4, to 'out.mp4': Metadata: encoder : Lavf55.21.100 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360, q=-1--1, 500 kb/s, 29.97 tbr, 30k tbn, 29.97 tbc Stream #0:1: Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s =================================== *Floating point exception (core dumped)* <== I found the reason, It was program tried access 0 value(from in_channel_layout) =================================== Any idea or suggestion?? -- View this message in context: http://libav-users.943685.n4.nabble.com/Is-there-a-way-to-encoding-PCM-to-AAC-tp4659145.html Sent from the libav-users mailing list archive at Nabble.com. From lkm9125 at gmail.com Fri Jan 17 07:04:18 2014 From: lkm9125 at gmail.com (funta) Date: Thu, 16 Jan 2014 22:04:18 -0800 (PST) Subject: [Libav-user] Inaccurate duration and play speed from calculating PTS while AAC encoding In-Reply-To: <1389869928123-4659136.post@n4.nabble.com> References: <1389869928123-4659136.post@n4.nabble.com> Message-ID: <1389938658465-4659146.post@n4.nabble.com> I've solved it -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Inaccurate-duration-and-play-speed-from-calculating-PTS-while-AAC-encoding-tp4659139p4659146.html Sent from the libav-users mailing list archive at Nabble.com. From mtaha.ansari at gmail.com Sat Jan 18 20:54:07 2014 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Sun, 19 Jan 2014 00:54:07 +0500 Subject: [Libav-user] Bytes per sample for different audio formats In-Reply-To: References: Message-ID: On Jan 17, 2014 8:45 PM, "Carl Eugen Hoyos" wrote: > > Taha Ansari writes: > > > While investigation few issues with adopted audio > > trans-coding techniques, I discovered that call to > > av_get_bytes_per_sample() for AV_SAMPLE_FMT_S16 > > returns '2', > > AV_SAMPLE_FMT_S16 -> 16 bit signed > 16 bit == 2 bytes > > > and for AV_SAMPLE_FMT_FLTP returns '4'. > > AV_SAMPLE_FMT_FLTP -> float (in the C sense) > float == 4 bytes > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user I see - many thanks for the clarification! -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinvinod at gmail.com Mon Jan 20 05:46:29 2014 From: vinvinod at gmail.com (=?UTF-8?B?4LK14LK/4LKo4LOL4LKm4LONIFZpbm9kIEggSQ==?=) Date: Mon, 20 Jan 2014 10:16:29 +0530 Subject: [Libav-user] URL WRITE Message-ID: Hi, I have a requirement that I need to save the converted video file to a server. Now I am saving the output of ffmpeg to a local file first and transferring it to the server via http post request. Can I do that via ffmpeg itself? like " ffmpeg -i input.mp4 -acodec copy -vcodec copy http://my.server.com/uploads/video0025.mp4" Is this possible? -- Vinod -------------- next part -------------- An HTML attachment was scrubbed... URL: From mtaha.ansari at gmail.com Mon Jan 20 11:59:13 2014 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Mon, 20 Jan 2014 15:59:13 +0500 Subject: [Libav-user] Muxing sample for FLTP input and FLTP audio, loses stereo audio Message-ID: Hi, Based on muxing sample that comes with FFmpeg docs, I have modified it, from input format as S16 to FLTP (planar stereo), and outputting to webm format (stereo). Since input is now FLTP, I am filling two arrays, then encoding again to FLTP. There are no obvious errors given on screen, but the resulting webm video does not play any audio (just the video content). This is just proof of concept in understanding things; here is an added (crude) function to fill up input FLTP stereo buffer: static void get_audio_frame_for_planar_stereo(int16_t **samples, int frame_size, int nb_channels) { int j, i, v[2]; int16_t *q1 = (int16_t *) samples[0]; int16_t *q2 = (int16_t *) samples[1]; for (j = 0; j < frame_size; j++) { v[0] = (int)(sin(t) * 10000); v[1] = (int)(tan(t) * 10000); *q1++ = v[0]; *q2++ = v[1]; t += tincr; tincr += tincr2; } } Which I am calling from inside write_audio_frame() function. Note also, wherever code reffered AV_SAMPLE_FMT_S16 as input, I have changed to AV_SAMPLE_FMT_FLTP. Whole workable source is here: https://gist.github.com/anonymous/05d1d7662e9feafc45a6 When run with ffprobe.exe, with these instructions: ffprobe -show_packets output.webm >output.txt I see nothing out of ordinary, all pts/dts values appear to be in place: https://gist.github.com/anonymous/3ed0d6308700ab991704 Could someone highlight cause of this mus-interpretation? Thanks for your time... -------------- next part -------------- An HTML attachment was scrubbed... URL: From nitrolinux722 at yahoo.com Tue Jan 21 01:42:52 2014 From: nitrolinux722 at yahoo.com (Jason Woodruff) Date: Mon, 20 Jan 2014 16:42:52 -0800 (PST) Subject: [Libav-user] save video file over http In-Reply-To: References: Message-ID: <1390264972360-4659153.post@n4.nabble.com> Hello, I am going to out on a limb and say, although I add no value to this thread, I would dare say, you would probably be better off using a bash script to output the finished file to the remote server. I haven't ever seen ffmpeg used in such a manner. But, I reply because this thread was looking lonely. Good Luck -Jason Woodruff -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-save-video-file-over-http-tp4659147p4659153.html Sent from the libav-users mailing list archive at Nabble.com. From niulicheng at gmail.com Tue Jan 21 03:17:00 2014 From: niulicheng at gmail.com (Licheng Niu) Date: Tue, 21 Jan 2014 10:17:00 +0800 Subject: [Libav-user] save video file over http In-Reply-To: References: Message-ID: <60D1EACE-DF68-41B8-A096-A45CD771D177@gmail.com> Hi, I think the most effective way is to implement your own output io to satisfy your requirement. -Licheng On 2014-1-17, at ??3:36, ?????? Vinod H I wrote: > Hi, > I have a requirement that I need to save the converted video file to a server. > Now I am saving the output of ffmpeg to a local file first and transferring it to the server via http post request using a different library. > Can I do that via ffmpeg itself? > like " ffmpeg -i input.mp4 -acodec copy -vcodec copy http://my.server.com/uploads/video0025.mp4" > Is this possible? > > -- > Vinod > > _______________________________________________ > 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 vinvinod at gmail.com Tue Jan 21 05:27:58 2014 From: vinvinod at gmail.com (=?UTF-8?B?4LK14LK/4LKo4LOL4LKm4LONIFZpbm9kIEggSQ==?=) Date: Tue, 21 Jan 2014 09:57:58 +0530 Subject: [Libav-user] save video file over http In-Reply-To: <60D1EACE-DF68-41B8-A096-A45CD771D177@gmail.com> References: <60D1EACE-DF68-41B8-A096-A45CD771D177@gmail.com> Message-ID: Thanks Jason. Thanks Licheng. I found this . https://lab.dyne.org/Ffmpeg/UseUrlProtocol The api calls in this page are deprecated now. But i will find the alternative. Atleast, I have something to try now. Another question. Can we know the exact size of the output video in advance? other way, Can ffmpeg take required video file size as input? On Tue, Jan 21, 2014 at 7:47 AM, Licheng Niu wrote: > Hi, > > I think the most effective way is to implement your own output io to > satisfy your requirement. > > -Licheng > > On 2014-1-17, at ??3:36, ?????? Vinod H I wrote: > > Hi, > I have a requirement that I need to save the converted video file to a > server. > Now I am saving the output of ffmpeg to a local file first and > transferring it to the server via http post request using a different > library. > Can I do that via ffmpeg itself? > like " ffmpeg -i input.mp4 -acodec copy -vcodec copy > http://my.server.com/uploads/video0025.mp4" > Is this possible? > > -- > Vinod > > _______________________________________________ > 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 > > -- Vinod H I -------------- next part -------------- An HTML attachment was scrubbed... URL: From yamusanivinay at gmail.com Tue Jan 21 08:11:53 2014 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Tue, 21 Jan 2014 12:41:53 +0530 Subject: [Libav-user] SEEK ISSUE Message-ID: Hi All, Actually an android application for playing music I used ffmpeg.I am using the following code for seeking the song in ffmpeg.. int defaultStreamIndex = av_find_default_stream_index(fmt_ctx); int seekStreamIndex = (audio_stream_index != -1)? audio_stream_index : defaultStreamIndex; int64_t seekTime = av_rescale_q(seekValue*AV_TIME_BASE, AV_TIME_BASE_Q,fmt_ctx->streams[seekStreamIndex]->time_base); int64_t seekStreamDuration = fmt_ctx->streams[seekStreamIndex]->duration; int flags = AVSEEK_FLAG_BACKWARD; if (seekTime > 0 && seekTime < seekStreamDuration) flags |= AVSEEK_FLAG_ANY; int ret = av_seek_frame(fmt_ctx, seekStreamIndex, seekTime,flags); if (ret < 0) ret = av_seek_frame(fmt_ctx, seekStreamIndex, seekTime,AVSEEK_FLAG_ANY); avcodec_flush_buffers(dec_ctx); The length of the seek bar is total duration in milliseconds..for ex:totalduration is 3:20 then seekbar length will be 200. The above code is working for some of the songs..but for some songs If I seek the song to for ex:3:00 or 2:40 then the song lasts for 3:50(actually duration is 3:20).If I don't seek and play it normally it ends at correct position.So please suggest me in solving this problem. Thanks & Regards, Bitfield. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Jan 21 11:16:40 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 21 Jan 2014 10:16:40 +0000 (UTC) Subject: [Libav-user] save video file over http References: <1390264972360-4659153.post@n4.nabble.com> Message-ID: Jason Woodruff writes: > I haven't ever seen ffmpeg used in such a manner. But since "ffmpeg -protocols" reports an output protocol http, I think it is supposed to work... Carl Eugen From cehoyos at ag.or.at Tue Jan 21 11:17:59 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 21 Jan 2014 10:17:59 +0000 (UTC) Subject: [Libav-user] save video file over http References: <60D1EACE-DF68-41B8-A096-A45CD771D177@gmail.com> Message-ID: ?????? Vinod H I writes: > Can we know the exact size of the output video in advance? Of course. rawvideo has a fixed size per frame, just multiply the size with the number of frames you output. > other way, Can ffmpeg take required video file size as input? I wonder how this could work in theory... Please do not top-post here, it is considered rude. Carl Eugen From stefasab at gmail.com Tue Jan 21 18:10:15 2014 From: stefasab at gmail.com (Stefano Sabatini) Date: Tue, 21 Jan 2014 18:10:15 +0100 Subject: [Libav-user] save video file over http In-Reply-To: References: Message-ID: <20140121171015.GL4258@barisone> In data Friday 2014-01-17 13:06:03 +0530, ?????? Vinod H I ha scritto: > Hi, > I have a requirement that I need to save the converted video file to a > server. > Now I am saving the output of ffmpeg to a local file first and transferring > it to the server via http post request using a different library. > Can I do that via ffmpeg itself? > like " ffmpeg -i input.mp4 -acodec copy -vcodec copy > http://my.server.com/uploads/video0025.mp4" this will remux the file (for example it might change timestamps). A probably better solution is to use the AVIO API, see for example tools/aviocat.c > Is this possible? From mayank77fromindia at gmail.com Tue Jan 21 14:09:04 2014 From: mayank77fromindia at gmail.com (Mayank Agarwal) Date: Tue, 21 Jan 2014 18:39:04 +0530 Subject: [Libav-user] Error in compiling ffmpeg Message-ID: Hi, when i am doing ffmpeg compiling using ./configure --toolchain=msvc i am getting the following error in config.log ./configure: line 728: c99wrap: command not found Trying to integrate ffmpeg with visual studio 2013 express on windows 7. Please help. Regards, Mayank -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrick at mysonicweb.de Tue Jan 21 23:10:28 2014 From: patrick at mysonicweb.de (Patrick Dehne) Date: Tue, 21 Jan 2014 22:10:28 +0000 Subject: [Libav-user] Error in compiling ffmpeg In-Reply-To: Message-ID: >>when i am doing ffmpeg compiling using >>./configure --toolchain=msvc >> >>i am getting the following error in config.log >> >>./configure: line 728: c99wrap: command not found Did you see the compile guide? http://ffmpeg.org/platform.html#Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows -- Patrick Dehne http://sonicweb.de https://twitter.com/SonicWebRadio https://facebook.com/SonicWebRadio -------------- next part -------------- An HTML attachment was scrubbed... URL: From boys21century at gmail.com Wed Jan 22 04:40:21 2014 From: boys21century at gmail.com (Ramu Chakravadhanula) Date: Wed, 22 Jan 2014 09:10:21 +0530 Subject: [Libav-user] Error in compiling ffmpeg In-Reply-To: References: Message-ID: See if this can help you. http://ramu492.blogspot.in/2013/06/porting-ffmpeg-on-to-winodws7-and.html /Ramu On 21 January 2014 18:39, Mayank Agarwal wrote: > Hi, > > when i am doing ffmpeg compiling using > ./configure --toolchain=msvc > > i am getting the following error in config.log > > ./configure: line 728: c99wrap: command not found > > Trying to integrate ffmpeg with visual studio 2013 express on windows 7. > > Please help. > > Regards, > Mayank > > _______________________________________________ > 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 boys21century at gmail.com Wed Jan 22 04:40:21 2014 From: boys21century at gmail.com (Ramu Chakravadhanula) Date: Wed, 22 Jan 2014 09:10:21 +0530 Subject: [Libav-user] Error in compiling ffmpeg In-Reply-To: References: Message-ID: See if this can help you. http://ramu492.blogspot.in/2013/06/porting-ffmpeg-on-to-winodws7-and.html /Ramu On 21 January 2014 18:39, Mayank Agarwal wrote: > Hi, > > when i am doing ffmpeg compiling using > ./configure --toolchain=msvc > > i am getting the following error in config.log > > ./configure: line 728: c99wrap: command not found > > Trying to integrate ffmpeg with visual studio 2013 express on windows 7. > > Please help. > > Regards, > Mayank > > _______________________________________________ > 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 cehoyos at ag.or.at Wed Jan 22 09:57:37 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 22 Jan 2014 08:57:37 +0000 (UTC) Subject: [Libav-user] Error in compiling ffmpeg References: Message-ID: Ramu Chakravadhanula writes: > See if this can help you. > > http://ramu492.blogspot.in/2013/06/porting-ffmpeg-on-to-winodws7-and.html This looks outdated. Please do not top-post here. Carl Eugen From ierumshanaya85 at gmail.com Wed Jan 22 16:22:51 2014 From: ierumshanaya85 at gmail.com (Ierum Shanaya) Date: Wed, 22 Jan 2014 20:52:51 +0530 Subject: [Libav-user] error in compiling ffmpeg/doc/examples Message-ID: hi, I have installed ffmpeg on Ubuntu 12.04 as specified in the link: https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide and when i try to compile the examples present under ffmpeg/examples, i get an error ffmpeg_sources/ffmpeg/libavutil/common.h:44:32: fatal error: libavutil/avconfig.h: No such file or directory the command i used to compile example file demuxing_decoding.c is $ gcc -o demuxing_decoding demuxing_decoding.c -lavutil -lavformat -lavcodec -lz -lavutil -lm And when i looked into libavutil directory, there was no avconfig.h. Could someone please let me know, where i have gone wrong. Thanks, Ierum -------------- next part -------------- An HTML attachment was scrubbed... URL: From bryan at metabahn.com Wed Jan 22 22:41:30 2014 From: bryan at metabahn.com (Bryan Powell) Date: Wed, 22 Jan 2014 15:41:30 -0600 Subject: [Libav-user] RTSP SET_PARAMETER Message-ID: I'm using ffmpeg to listen to an audio stream over RTSP (in iOS). This is working great, but I also need the ability to use the SET_PARAMETER method to set custom options on the server. Surely this is possible, even at a low level, but I'm having trouble figuring out an approach. I've scoured the docs and Google for the last few days without much luck. Any direction you can provide would be much appreciated! Bryan P. -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.suma at amtservices.it Wed Jan 22 15:41:12 2014 From: marco.suma at amtservices.it (marcosuma) Date: Wed, 22 Jan 2014 06:41:12 -0800 (PST) Subject: [Libav-user] How to capture audio from microphone with libav* Message-ID: <1390401672863-4659164.post@n4.nabble.com> Hi everyone, how can i open a microphone device using ffmpeg API ? Thanks in advance, Marco -- View this message in context: http://libav-users.943685.n4.nabble.com/How-to-capture-audio-from-microphone-with-libav-tp4659164.html Sent from the libav-users mailing list archive at Nabble.com. From anshul.ffmpeg at gmail.com Thu Jan 23 11:55:01 2014 From: anshul.ffmpeg at gmail.com (anshul) Date: Thu, 23 Jan 2014 16:25:01 +0530 Subject: [Libav-user] error in compiling ffmpeg/doc/examples In-Reply-To: References: Message-ID: <52E0F505.5040504@gmail.com> On 01/22/2014 08:52 PM, Ierum Shanaya wrote: > hi, > > I have installed ffmpeg on Ubuntu 12.04 as specified in the link: > > https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide > > and when i try to compile the examples present under ffmpeg/examples, > i get an error > > ffmpeg_sources/ffmpeg/libavutil/common.h:44:32: fatal error: > libavutil/avconfig.h: No such file or directory > > the command i used to compile example file demuxing_decoding.c is > > $ gcc -o demuxing_decoding demuxing_decoding.c -lavutil -lavformat > -lavcodec -lz -lavutil -lm > > And when i looked into libavutil directory, there was no avconfig.h. > > Could someone please let me know, where i have gone wrong. > > Thanks, > Ierum > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user have you configured and install ffmpeg before trying to compile examples Thanks Anshul -------------- next part -------------- An HTML attachment was scrubbed... URL: From anshul.ffmpeg at gmail.com Thu Jan 23 12:04:52 2014 From: anshul.ffmpeg at gmail.com (anshul) Date: Thu, 23 Jan 2014 16:34:52 +0530 Subject: [Libav-user] Why we Shell32 library in pkg-config of libavfilter Message-ID: <52E0F754.1040608@gmail.com> Hi Shell32 is an qt library, I would like to know what part of ffmpeg is using shell32 library output of pkg-config --libs libavfilter on windows cygwin -pthread -L/usr/local/lib -lavfilter -lswresample -lswscale -lavformat -lavcodec -lavicap32 -lbz2 -lz -lpsapi -ladvapi32 -lshell32 -lavutil -lm If any one knows why we use -ladvapi32 and -lpsapi, lavicap32 is also welcome Thanks Anshul From ggarra13 at gmail.com Thu Jan 23 15:41:43 2014 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Thu, 23 Jan 2014 11:41:43 -0300 Subject: [Libav-user] Why we Shell32 library in pkg-config of libavfilter In-Reply-To: <52E0F754.1040608@gmail.com> References: <52E0F754.1040608@gmail.com> Message-ID: <52E12A27.7060609@gmail.com> On 23/01/14 08:04, anshul wrote: > Hi > > Shell32 is an qt library, I would like to know what part of ffmpeg is > using shell32 library No, it isn't. Shell32 is a windows library. Probably cygwin uses it. Use mingw to remove those dependencies. From me at victortoso.com Thu Jan 23 20:33:13 2014 From: me at victortoso.com (Victor Toso) Date: Thu, 23 Jan 2014 17:33:13 -0200 Subject: [Libav-user] error in compiling ffmpeg/doc/examples In-Reply-To: <52E0F505.5040504@gmail.com> References: <52E0F505.5040504@gmail.com> Message-ID: check the output of pkg-config --libs --cflags libavutil libavformat libavcodec and use it something like: gcc -o demuxing_decoding demuxing_decoding.c `pkg-config --libs --cflags libavutil libavformat libavcodec` On Thu, Jan 23, 2014 at 8:55 AM, anshul wrote: > On 01/22/2014 08:52 PM, Ierum Shanaya wrote: > > hi, > > I have installed ffmpeg on Ubuntu 12.04 as specified in the link: > > https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide > > and when i try to compile the examples present under ffmpeg/examples, i get > an error > > ffmpeg_sources/ffmpeg/libavutil/common.h:44:32: fatal error: > libavutil/avconfig.h: No such file or directory > > the command i used to compile example file demuxing_decoding.c is > > $ gcc -o demuxing_decoding demuxing_decoding.c -lavutil -lavformat -lavcodec > -lz -lavutil -lm > > And when i looked into libavutil directory, there was no avconfig.h. > > Could someone please let me know, where i have gone wrong. > > Thanks, > Ierum > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > > have you configured and install ffmpeg before trying to compile examples > Thanks > Anshul > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- ------------------------- Victor Toso From jan at jdrabner.eu Mon Jan 27 17:54:45 2014 From: jan at jdrabner.eu (Jan Drabner) Date: Mon, 27 Jan 2014 17:54:45 +0100 Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work Message-ID: <52E68F55.3040603@jdrabner.eu> Hey, I am decoding an OGG video (theora & vorbis as codecs) and want to show it on the screen (using Ogre 3D) while playing its sound. I can decode the image stream just fine and the video plays perfectly with the correct frame rate, etc. However, I cannot get the sound to play at all with OpenAL. Here is how I decode audio packets (in a background thread, the equivalent works just fine for the image stream of the video file): |//------------------------------------------------------------------------------ int decodeAudioPacket( AVPacket& p_packet, AVCodecContext* p_audioCodecContext, AVFrame* p_frame, FFmpegVideoPlayer* p_player, VideoInfo& p_videoInfo) { // Decode audio frame int got_frame= 0; int decoded= avcodec_decode_audio4(p_audioCodecContext, p_frame, &got_frame, &p_packet); if (decoded< 0) { p_videoInfo.error= "Error decoding audio frame."; return decoded; } // Frame is complete, store it in audio frame queue if (got_frame) { int bufferSize= av_samples_get_buffer_size(NULL, p_audioCodecContext->channels, p_frame->nb_samples, p_audioCodecContext->sample_fmt, 0); int64_t duration= p_frame->pkt_duration; int64_t dts= p_frame->pkt_dts; if (staticOgreLog) { staticOgreLog->logMessage("Audio frame bufferSize / duration / dts:" + boost::lexical_cast(bufferSize) + " /" + boost::lexical_cast(duration) + " /" + boost::lexical_cast(dts), Ogre::LML_NORMAL); } // Create the audio frame AudioFrame* frame= new AudioFrame(); frame->dataSize= bufferSize; frame->data= new uint8_t[bufferSize]; memcpy(frame->data, p_frame->data, bufferSize); double timeBase= ((double)p_audioCodecContext->time_base.num) / (double)p_audioCodecContext->time_base.den; frame->lifeTime= duration* timeBase; p_player->addAudioFrame(frame); } return decoded; } | So, as you can see, I decode the frame, memcpy it to my own struct, AudioFrame. Now, when the sound is played, I use these audio frame like this: |//------------------------------------------------------------------------------|| int numBuffers= 4; ALuint buffers[4]; alGenBuffers(numBuffers, buffers); ALenum success= alGetError(); if(success!= AL_NO_ERROR) { CONSOLE_LOG("Error on alGenBuffers :" + Ogre::StringConverter::toString(success) + alGetString(success)); return; } // Fill a number of data buffers with audio from the stream std::vector audioBuffers; std::vector audioBufferSizes; unsigned int numReturned= FFMPEG_PLAYER->getDecodedAudioFrames(numBuffers, audioBuffers, audioBufferSizes); // Assign the data buffers to the OpenAL buffers for (unsigned int i= 0; i< numReturned; ++i) { alBufferData(buffers[i], _streamingFormat, audioBuffers[i], audioBufferSizes[i], _streamingFrequency); success= alGetError(); if(success!= AL_NO_ERROR) { CONSOLE_LOG("Error on alBufferData :" + Ogre::StringConverter::toString(success) + alGetString(success) + " size:" + Ogre::StringConverter::toString(audioBufferSizes[i])); return; } } // Queue the buffers into OpenAL alSourceQueueBuffers(_source, numReturned, buffers); success= alGetError(); if(success!= AL_NO_ERROR) { CONSOLE_LOG("Error queuing streaming buffers:" + Ogre::StringConverter::toString(success) + alGetString(success)); return; } } alSourcePlay(_source);| The format and frequency I give to OpenAL are AL_FORMAT_STEREO16 (it is a stereo sound stream) and 48000 (which is the sample rate of the AVCodecContext of the audio stream). And during playback, I do the following to refill OpenAL's buffers: |//------------------------------------------------------------------------------|||| ALint numBuffersProcessed; // Check if OpenAL is done with any of the queued buffers alGetSourcei(_source, AL_BUFFERS_PROCESSED, &numBuffersProcessed); if(numBuffersProcessed<= 0) return; // Fill a number of data buffers with audio from the stream std::vector audioBuffers; std::vector audioBufferSizes; unsigned int numFilled= FFMPEG_PLAYER->getDecodedAudioFrames(numBuffersProcessed, audioBuffers, audioBufferSizes); // Assign the data buffers to the OpenAL buffers ALuint buffer; for (unsigned int i= 0; i< numFilled; ++i) { // Pop the oldest queued buffer from the source, // fill it with the new data, then re-queue it alSourceUnqueueBuffers(_source, 1, &buffer); ALenum success= alGetError(); if(success!= AL_NO_ERROR) { CONSOLE_LOG("Error Unqueuing streaming buffers:" + Ogre::StringConverter::toString(success)); return; } alBufferData(buffer, _streamingFormat, audioBuffers[i], audioBufferSizes[i], _streamingFrequency); success= alGetError(); if(success!= AL_NO_ERROR) { CONSOLE_LOG("Error on re- alBufferData:" + Ogre::StringConverter::toString(success)); return; } alSourceQueueBuffers(_source, 1, &buffer); success= alGetError(); if(success!= AL_NO_ERROR) { CONSOLE_LOG("Error re-queuing streaming buffers:" + Ogre::StringConverter::toString(success) + "" + alGetString(success)); return; } } // Make sure the source is still playing, // and restart it if needed. ALint playStatus; alGetSourcei(_source, AL_SOURCE_STATE, &playStatus); if(playStatus!= AL_PLAYING) alSourcePlay(_source);| As you can see, I do quite heavy error checking. But I do not get any errors. But the only thing that plays is a constant clicking noise. The video itself is not broken, it can be played fine on any player. OpenAL can also play *.way files just fine in the same application, so it is also working. Any ideas what could be wrong here or how to do this correctly? My only guess is that somehow, FFmpeg's decode function does not produce data OpenGL can read. But this is as far as the FFmpeg decode example goes, so I don't know what's missing. As I understand it, the decode_audio4 function decodes the frame to raw data. And OpenAL should be able to work with RAW data (or rather, doesn't work with anything else). P.S: You can also find this question on StackOverflow, figured it wouldn't hurt to ask on multiple places: http://stackoverflow.com/questions/21386135/ffmpeg-openal-playback-streaming-sound-from-video-wont-work -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Jan 27 20:36:10 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 27 Jan 2014 19:36:10 +0000 (UTC) Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work References: <52E68F55.3040603@jdrabner.eu> Message-ID: Jan Drabner writes: > However, I cannot get the sound to play at all with OpenAL. Where do you call libswresample or aresample to convert from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16 ? Carl Eugen From jan at jdrabner.eu Mon Jan 27 20:46:20 2014 From: jan at jdrabner.eu (Jan Drabner) Date: Mon, 27 Jan 2014 20:46:20 +0100 Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work In-Reply-To: References: <52E68F55.3040603@jdrabner.eu> Message-ID: <52E6B78C.5050507@jdrabner.eu> Well. I don't. I was assuming that decode_audio4(...) was already giving output in that format. I mean, after decoding, the data has to be in SOME format, so I assumed it was a standard format. Possibly a bit naive on my part. But then again, not a single sample with FFmpeg & OpenAL I found was using aresample, so this is the first time I actually hear of it. I will try using it now and see how well that goes. Am 27.01.2014 20:36, schrieb Carl Eugen Hoyos: > Jan Drabner writes: > >> However, I cannot get the sound to play at all with OpenAL. > Where do you call libswresample or aresample to convert > from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16 ? > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From jan at jdrabner.eu Mon Jan 27 22:09:52 2014 From: jan at jdrabner.eu (Jan Drabner) Date: Mon, 27 Jan 2014 22:09:52 +0100 Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work In-Reply-To: <52E6B78C.5050507@jdrabner.eu> References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> Message-ID: <52E6CB20.8080902@jdrabner.eu> Okay, I tried using swr_convert, but it always crashes when trying to divide by 0. Basically, I have the same problem as those two guys: http://stackoverflow.com/questions/14448413/why-am-i-getting-fpe-when-using-swresample-1-1 and https://ffmpeg.org/trac/ffmpeg/ticket/1834 However, I DO call swr_init() and there is no error whatsoever. And it never reaches the point in swr_init() where context->postin would be set so it HAS to crash there. Here is the code I use to init and to the swr_convert: // Init context SwrContext* swrContext = swr_alloc_set_opts(NULL, audioCodecContext->channel_layout, AV_SAMPLE_FMT_S16P, audioCodecContext->sample_rate, audioCodecContext->channel_layout, audioCodecContext->sample_fmt, audioCodecContext->sample_rate, 0, NULL); int result = swr_init(swrContext); // Conversion int outputSamples = swr_convert(swrContext, &p_destBuffer, 2048, (const uint8_t**)p_frame->extended_data, p_frame->nb_samples); As I said, I receive no errors, but the crash when FFmpeg tries to divide by 0 inside |swri_realloc_audio|. What am I doing wrong? Am 27.01.2014 20:46, schrieb Jan Drabner: > Well. I don't. > > I was assuming that decode_audio4(...) was already giving output in > that format. I mean, after decoding, the data has to be in SOME > format, so I assumed it was a standard format. Possibly a bit naive on > my part. > But then again, not a single sample with FFmpeg & OpenAL I found was > using aresample, so this is the first time I actually hear of it. > > I will try using it now and see how well that goes. > > Am 27.01.2014 20:36, schrieb Carl Eugen Hoyos: >> Jan Drabner writes: >> >>> However, I cannot get the sound to play at all with OpenAL. >> Where do you call libswresample or aresample to convert >> from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16 ? >> >> 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 jan at jdrabner.eu Tue Jan 28 11:11:21 2014 From: jan at jdrabner.eu (Jan Drabner) Date: Tue, 28 Jan 2014 11:11:21 +0100 Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work In-Reply-To: <52E6CB20.8080902@jdrabner.eu> References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> Message-ID: <52E78249.2070608@jdrabner.eu> I made some further progress by setting the OpenAL format to AL_FORMAT_STEREO_FLOAT32 instead of STEREO16. Makes sense, as the decoded frames are in FLTP format. Also, I went back to not use swr_convert. It simply won't work and only crashes without any indication why. And FLTP seems to be the correct format already when openAL uses STEREO_FLOAT32. At least now, the sound is played at the correct speed. However, it is still very high pitched, so something is still very much broken. Am 27.01.2014 22:09, schrieb Jan Drabner: > Okay, I tried using swr_convert, but it always crashes when trying to > divide by 0. > Basically, I have the same problem as those two guys: > > http://stackoverflow.com/questions/14448413/why-am-i-getting-fpe-when-using-swresample-1-1 > and > https://ffmpeg.org/trac/ffmpeg/ticket/1834 > > However, I DO call swr_init() and there is no error whatsoever. > And it never reaches the point in swr_init() where context->postin > would be set so it HAS to crash there. > > Here is the code I use to init and to the swr_convert: > > // Init context > SwrContext* swrContext = swr_alloc_set_opts(NULL, > audioCodecContext->channel_layout, AV_SAMPLE_FMT_S16P, > audioCodecContext->sample_rate, > audioCodecContext->channel_layout, > audioCodecContext->sample_fmt, audioCodecContext->sample_rate, > 0, NULL); > int result = swr_init(swrContext); > > // Conversion > int outputSamples = swr_convert(swrContext, > &p_destBuffer, 2048, > (const > uint8_t**)p_frame->extended_data, p_frame->nb_samples); > > As I said, I receive no errors, but the crash when FFmpeg tries to > divide by 0 inside |swri_realloc_audio|. > What am I doing wrong? > > Am 27.01.2014 20:46, schrieb Jan Drabner: >> Well. I don't. >> >> I was assuming that decode_audio4(...) was already giving output in >> that format. I mean, after decoding, the data has to be in SOME >> format, so I assumed it was a standard format. Possibly a bit naive >> on my part. >> But then again, not a single sample with FFmpeg & OpenAL I found was >> using aresample, so this is the first time I actually hear of it. >> >> I will try using it now and see how well that goes. >> >> Am 27.01.2014 20:36, schrieb Carl Eugen Hoyos: >>> Jan Drabner writes: >>> >>>> However, I cannot get the sound to play at all with OpenAL. >>> Where do you call libswresample or aresample to convert >>> from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16 ? >>> >>> 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 cehoyos at ag.or.at Tue Jan 28 11:48:37 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 28 Jan 2014 10:48:37 +0000 (UTC) Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> <52E78249.2070608@jdrabner.eu> Message-ID: Jan Drabner writes: > And FLTP seems to be the correct format already > when openAL uses STEREO_FLOAT32. I don't think this is correct, I would expect that STEREO_FLOAT32 corresponds to AV_SAMPLE_FMT_FLTP Please stop top-posting here, Carl Eugen From jan at jdrabner.eu Tue Jan 28 11:54:34 2014 From: jan at jdrabner.eu (Jan Drabner) Date: Tue, 28 Jan 2014 11:54:34 +0100 Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work In-Reply-To: References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> <52E78249.2070608@jdrabner.eu> Message-ID: <52E78C6A.2030104@jdrabner.eu> Well, that is what I said. AV_SAMPLE_FMT_FLTP == AL_FORMAT_STEREO_FLOAT32. At least that is what I guess. So this would mean that I do not need to call swr_convert after decode_audio4, as decode_audio4 produces AV_SAMPLE_FMT_FLTP already. Right? What do you mean with top-posting? I simply answered the email (Do I need to set something specific, using Thunderbird?). Am 28.01.2014 11:48, schrieb Carl Eugen Hoyos: > Jan Drabner writes: > >> And FLTP seems to be the correct format already >> when openAL uses STEREO_FLOAT32. > I don't think this is correct, I would expect that > STEREO_FLOAT32 corresponds to AV_SAMPLE_FMT_FLTP > > Please stop top-posting here, Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From cehoyos at ag.or.at Tue Jan 28 11:58:52 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 28 Jan 2014 10:58:52 +0000 (UTC) Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> <52E78249.2070608@jdrabner.eu> <52E78C6A.2030104@jdrabner.eu> Message-ID: Jan Drabner writes: > Well, that is what I said. > AV_SAMPLE_FMT_FLTP == AL_FORMAT_STEREO_FLOAT32. No. (At least I find it very unlikely.) Carl Eugen From jan at jdrabner.eu Tue Jan 28 12:11:38 2014 From: jan at jdrabner.eu (Jan Drabner) Date: Tue, 28 Jan 2014 12:11:38 +0100 Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work In-Reply-To: References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> <52E78249.2070608@jdrabner.eu> <52E78C6A.2030104@jdrabner.eu> Message-ID: <52E7906A.3070603@jdrabner.eu> And you are correct. I used swr_convert to convert it to AV_SAMPLE_FMT_FLT (no P!). To my surprise, this doesn't crash swr_convert, like converting from FLTP to S16P (or S16) does. And finally the sound is working! So, this true: AV_SAMPLE_FMT_FLT == AL_FORMAT_STEREO_FLOAT32. I seriously hope this will help someone, at some point. Thanks for hinting me to the swr_convert. Am 28.01.2014 11:58, schrieb Carl Eugen Hoyos: > Jan Drabner writes: > >> Well, that is what I said. >> AV_SAMPLE_FMT_FLTP == AL_FORMAT_STEREO_FLOAT32. > No. > (At least I find it very unlikely.) > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From cehoyos at ag.or.at Tue Jan 28 12:16:45 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 28 Jan 2014 11:16:45 +0000 (UTC) Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> <52E78249.2070608@jdrabner.eu> Message-ID: Carl Eugen Hoyos writes: > Jan Drabner ...> writes: > > > And FLTP seems to be the correct format already > > when openAL uses STEREO_FLOAT32. > > I don't think this is correct, I would expect that > STEREO_FLOAT32 corresponds to AV_SAMPLE_FMT_FLTP _^_ Sorry, this typo didn't make my mail particularly useful... Note that your source code was so incomplete that one couldn't see which formats you were trying to convert. Before posting here again, please read http://ffmpeg.org/contact.html (it IS rude not to read it) and please do not open tickets on trac with support requests, I consider this very bad practice. Carl Eugen From jan at jdrabner.eu Tue Jan 28 12:33:09 2014 From: jan at jdrabner.eu (Jan Drabner) Date: Tue, 28 Jan 2014 12:33:09 +0100 Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work In-Reply-To: References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> <52E78249.2070608@jdrabner.eu> Message-ID: <52E79575.9080705@jdrabner.eu> Well, I wrote that I am decoding Ogg (with theora and vorbis as codecs). I thought that was enough. Probably not :) I never set the decoding formats myself, instead I use the ffmpeg function to find the correct decoders automatically. Sorry for the top-posting. It just normally doesn't matter when writing emails. Now I know it. "and please do not open tickets on trac with support requests, I consider this very bad practice." You are right. But I never asked for support. I reported what is in my opinion bug. swr_convert crashes under some circumstances, without telling any reason. If that is not a bug, or a severely lacking feature or documentation, I don't know what is. I still have no idea why it should not be possible to convert from any format to any other. sws_scale can do that just fine. And as swr_convert is exactly the same as sws_scale (just for audio), from a user perspective, I was assuming it should behave the same. A simple addition to the documentation "Following conversions are invalid: ..." would be VERY helpful. If that even was the problem. From cehoyos at ag.or.at Tue Jan 28 13:22:03 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 28 Jan 2014 12:22:03 +0000 (UTC) Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> <52E78249.2070608@jdrabner.eu> <52E79575.9080705@jdrabner.eu> Message-ID: Jan Drabner writes: > But I never asked for support. I reported what is in my > opinion bug. Let's see. > swr_convert crashes under some circumstances, Definitely. > without telling any reason. Yes and no. If you had provided a backtrace as requested on http://ffmpeg.org/bugreports.html I suspect one would have been able to see what's wrong. (Everybody was able to guess what's wrong but it is often a bad idea to rely on guessing when answering questions here.) The relevant functions take a pointer to input data structures and a pointer to output data structures as parameters. In your case, you initialised the conversion functions saying "I want to convert to a planar format", so the actual conversion function expected you to pass a pointer to pointers. But instead you passed a pointer to allocated memory (it may have been different but this is what generally happens). Do you really think there is a possibility for the conversion function to know (in advance) that dereferencing the pointer you passed will lead to a segfault? And do you agree that it is impossible to "tell a reason" in this case? > If that is not a bug, or a severely lacking feature or > documentation, I don't know what is. It may be missing documentation (it possibly is) but then you should not write "crash" but instead send a documentation update (now) to ffmpeg-devel. > I still have no idea why it should not be possible > to convert from any format to any other. That is exactly what it does. > sws_scale can do that just fine. But it will of course also (immediately) crash if you pass a pointer to RGB24 after initialising for GBRP. Carl Eugen From cehoyos at ag.or.at Tue Jan 28 13:25:20 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 28 Jan 2014 12:25:20 +0000 (UTC) Subject: [Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work References: <52E68F55.3040603@jdrabner.eu> <52E6B78C.5050507@jdrabner.eu> <52E6CB20.8080902@jdrabner.eu> <52E78249.2070608@jdrabner.eu> Message-ID: Jan Drabner writes: > SwrContext* swrContext = swr_alloc_set_opts(NULL, > ??????????????? audioCodecContext->channel_layout, > AV_SAMPLE_FMT_S16P It is unlikely that this is correct (and it explains the segfault). Carl Eugen From brado at bighillsoftware.com Wed Jan 29 18:08:55 2014 From: brado at bighillsoftware.com (Bradley O'Hearne) Date: Wed, 29 Jan 2014 10:08:55 -0700 Subject: [Libav-user] How to send RTMP / AMF data with libavformat Message-ID: <5E283186-D95F-42CB-825C-CEA5687F7E2C@bighillsoftware.com> Hello, I am presently successfully streaming video / audio (RTMP) using libavformat. Basically I now need to have the RTMP connection process configure the receiving server for appending video (by default, a new video is created). Per the RTMP spec, this is accomplished by adding AMF data to the body of the RTMP connection request. I have the structure of the AMF data ready to go, but I do not know the proper way to configure (presumably) the AVOutputFormat or the AVFormatContext for this data. I would assume this can be done, as I?m pretty sure based on the FFmpeg documentation that this can be done with the command line binary. Can anyone lend some guidance to how to accomplish this? Thanks, Brad From abhayadevs at gmail.com Thu Jan 30 09:45:37 2014 From: abhayadevs at gmail.com (Abhayadev S) Date: Thu, 30 Jan 2014 14:15:37 +0530 Subject: [Libav-user] AC3 Parser Message-ID: Hi, I am looking for a ac3 meta data read/write tool. couldn't find one and hence thought of developing one using the ffmpeg libs. need to understand the programming techniques to use the ffmpeg libs/tools and on a quick round trip i think i should be able to develop the tool using the libavcode with the already existing ac3 parser. somebody just thourw some light in to the basic initialising or infr setup API sequences of the ffmpeg. Thanks in advance. PS: Plan is to have a c application to extract meta dat from the file and create an xml which can be translated in to a GUI and data can be fed back via the same xml and the application can update the same in the ac3 file. Regards, Abhayadev S https://plus.google.com/+AbhayadevS/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Jan 30 11:30:09 2014 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 30 Jan 2014 10:30:09 +0000 (UTC) Subject: [Libav-user] AC3 Parser References: Message-ID: Abhayadev S writes: > PS: Plan is to have a c application to extract meta > dat from the file and create an xml What's wrong with ffprobe? Carl Eugen From anshul.ffmpeg at gmail.com Thu Jan 30 12:03:39 2014 From: anshul.ffmpeg at gmail.com (anshul) Date: Thu, 30 Jan 2014 16:33:39 +0530 Subject: [Libav-user] AC3 Parser In-Reply-To: References: Message-ID: <52EA318B.1080607@gmail.com> On 01/30/2014 04:00 PM, Carl Eugen Hoyos wrote: > Abhayadev S writes: > >> PS: Plan is to have a c application to extract meta >> dat from the file and create an xml > What's wrong with ffprobe? > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user I think for C application ffprobe will not work, but that could be an good example to start with. Thanks Anshul From ytb.ffmpeg at gmail.com Thu Jan 30 16:13:23 2014 From: ytb.ffmpeg at gmail.com (ytb ffmpeg) Date: Thu, 30 Jan 2014 16:13:23 +0100 Subject: [Libav-user] H264/H265 videos on the Treansport Stream Message-ID: Hi I'm trying to put H264/H265 videos in the Transport Stream by the FFMPEG API, especially livavformat. At first I had the error "first pts value must be set"; but after setting the pts value equal to the dts value, I have not seen it any more. But here is my question: how do we set the correct PTS value? I'm thinking about the decoding function in order to get the right PTS value but how can I call these functions in the Transport Stream multiplexing part in FFMPEG? Thanks a lot for your advice and help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrey.krieger.utkin at gmail.com Fri Jan 31 12:07:52 2014 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Fri, 31 Jan 2014 13:07:52 +0200 Subject: [Libav-user] How to send RTMP / AMF data with libavformat In-Reply-To: <5E283186-D95F-42CB-825C-CEA5687F7E2C@bighillsoftware.com> References: <5E283186-D95F-42CB-825C-CEA5687F7E2C@bighillsoftware.com> Message-ID: 2014-01-29 Bradley O'Hearne : > Hello, > > I am presently successfully streaming video / audio (RTMP) using libavformat. Basically I now need to have the RTMP connection process configure the receiving server for appending video (by default, a new video is created). Per the RTMP spec, this is accomplished by adding AMF data to the body of the RTMP connection request. > > I have the structure of the AMF data ready to go, but I do not know the proper way to configure (presumably) the AVOutputFormat or the AVFormatContext for this data. I would assume this can be done, as I'm pretty sure based on the FFmpeg documentation that this can be done with the command line binary. > > Can anyone lend some guidance to how to accomplish this? Maybe give us an idea how does it work for you with command line. Reviewing rtmp, librtmp protocols descriptions, i don't see such option documented. If there is such option, then use it through AVDictionary parameter to avio_open2(). If not, then patch the protocol driver you use do add that option, and use through AVDictionary parameter, and, optionally, post the patch in ffmpeg-devel if your feature is something documented and/or conventional for RTMP protocol. -- Andrey Utkin