Re: [FFmpeg-devel] [PATCH] ppc: replace vec_ld(0), vec_ld(1) by VEC_LD2() which has fewer loads
On Sat, Nov 15, 2014 at 07:28:25PM -0700, Pavel Koshevoy wrote: On 11/15/14 18:12, James Almer wrote: On 15/11/14 1:50 AM, Michael Niedermayer wrote: On Fri, Nov 14, 2014 at 09:00:31PM -0700, Pavel Koshevoy wrote: I ran both builds twice and captured the output from the second run of each build, it's in the attachment. By the looks of it there is no difference in performance. to compare START/STOP_TIMER data its generally best to run the test a few times (like 3) and compare the values from each that have some specific number or runs, like 681 UNITS in MC, 4192359 runs, 1945 skips0:01:40.88 bitrate=N/A vs. 668 UNITS in MC, 4192326 runs, 1978 skips0:01:40.16 bitrate=N/A but from these 2 tests it seems you are correct and theres no significant difference so theres probably not much point in doing further tests It might be a good idea to try -threads 1 for the input file as well I've done 4 runs for each build using vec_ld and VEC_LD2, and logged the results of the last 3 runs for each build. The results are in the attachment. This time I added -an -threads 1 and the fps went up for both builds. It seems VEC_LD2 is slightly faster. I am not sure I've put -threads 1 in the right place on the command line, and I don't know if it matters -- this is a single-core ppc G4. Let me know if you would like me to try something else. no, thanks alot it seems the conclusion is that its 1 cpu cycle faster for you and slower for carl, thus overall its basically the same speed. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] web/bower.json: Detab
On Sat, Nov 15, 2014 at 09:26:09PM -0800, Timothy Gu wrote: Signed-off-by: Timothy Gu timothyg...@gmail.com --- bower.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Experiences in using ffmpeg to transcode broadcast video
A follow-up (I'll write this up better somewhere too once I get a chance). I've rewritten my transcoding pipeline, avoiding -copyts and it looks pretty promising. I now: 1. cut the input mpegts into pieces that have a) the same aspect ratio and b) monotonic timestamps (for both audio and video); I cut it using dd (rather than ffmpeg), which can't go wrong :-) 2. sync audio and video, overlay subtitles and transcode the pieces (skipping pieces that are too small to contain decodable audio and video) into mp4, with a GOP length suitable for fragmenting 3. concatenate the transcoded mp4 pieces with the concat demuxer 4. fragment the concatenated mp4 into ismv Now I'm using ffmpeg's reasonably robust handling of mpegts (given monotonic timestamps) without needing -copyts, as the concat demuxer will fix up the timestamps for the pieces so that the pieces can all start at 0 and I'm syncing up audio and video before concatenating. There are still places that can be a bit flaky (what is 'too small'?, handling those frames that straddle the discontinuity where dts is on one side and pts on the other, maybe badly broken audio input can't be synced). Mika On 29 October 2014 13:49, Mika Raento mi...@iki.fi wrote: Tickets for sub2video and async not working with non-monotonic input, using -copyts: https://trac.ffmpeg.org/ticket/4062 https://trac.ffmpeg.org/ticket/4064 Hm. Lots of my issues seem to relate to using -copyts. I had trouble keeping all video and all audio if there were periods where one or the other were missing (esp. in the beginning). Maybe I could make this simpler if I'd relax that requirement (I don't know how much happier my users are if they get audio but no video, rather than nothing). Mika On 29 October 2014 10:38, Mika Raento mi...@iki.fi wrote: segment muxer PIDs were fixed in https://github.com/FFmpeg/FFmpeg/commit/502fc3b3d4b36015562d19d74f27d0a4ff835c4e by me On 29 October 2014 10:17, Mika Raento mi...@iki.fi wrote: Hi Thanks for the feedback. I'll try to capture at least some of these in tickets, and reply on this thread as I go along. Async not working with damaged audio input is https://trac.ffmpeg.org/ticket/2693 (existing ticket) Sub2video not working with negative timestamps is https://trac.ffmpeg.org/ticket/4062 (new ticket) Mika On 27 October 2014 01:00, Michael Niedermayer michae...@gmx.at wrote: On Wed, Sep 24, 2014 at 10:43:40AM +0300, Mika Raento wrote: Dear all This mail is meant mainly as a note to other potential users, but possibly as input to development - time allowing I might be able to pick up some of the pieces myself. It's also a thank-you for all the hard work in ffmpeg. I've successfully implemented a transcoding pipeline for producing multi-bitrate fragmented mp4 files from broadcast DVB input. More concretely, I'm taking in broadcast TS captures with either mpeg2 video and mp2 audio (SD, varying aspect ratio) or h264 video and aac audio, both potentially with dvbsub. From that I'm producing ISMV output with multiple bitrate h264 video at fixed 16:9 aspect ratio and multiple bitrate aac audio, with burned subtitles. The ISMV outputs are post-processed with tools/ismindex and with the hls muxer. There are number of limitations in ffmpeg that I've had to work around: - I haven't gotten sub2video or async working without reasonably monotonous DTS. Broadcast TS streams can easily contain backward jumps in time (e.g., a cheapo source that plays mp4 files and starts each file at 0). The fix is to cut the TS into pieces at timestamp jump locations and using '-itsoffset' to rewrite the timestamps and then concatenate. I'm using the segment and concat muxers for that. - Sub2video doesn't work with negative timestamps, so I use '-itsoffset' to get positive timestamps - For HD streams, I need to scale up the sub2video results from SD to HD. Sub2video doesn't handle the HD subtitle geometries. I'm not enough of an expert to know whether that's the issue, or whether that's just the way it's supposed to work with SD subs (typical) with HD video. - For columnboxing, I use the scale, pad and setdar video filters. These work fine, but their parameters are only evaluated at start, so I need to cut the video into pieces with a single aspect ratio first and concatenate later. - Audio sync (using aresample) gets confused if the input contains errors, so I need to first re-encode audio (with '-copyts') and only after that synchronize. - The TS PIDs are not kept over the segment muxer, so I given them on the command line with '-streamid'. a bit late reply but bug reports or feature requests for all these are welcome unless there are already tickets for them assuming these issues still exist thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher
Re: [FFmpeg-devel] [PATCH 1/3] web: Remove all comments in the cleaned CSS
On Sat, Nov 15, 2014 at 09:26:08PM -0800, Timothy Gu wrote: http://ffmpeg.org/css/style.min.css and the copy in ffmpeg/doc are both generated using this option. Signed-off-by: Timothy Gu timothyg...@gmail.com --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart then the original author, trying to rewrite it will not make it better. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Modified force_key_frames option to accept frame numbers
Thank you for your reply. Date: Mon, 10 Nov 2014 14:18:25 +0100 From: geo...@nsup.org To: ffmpeg-devel@ffmpeg.org CC: sylwek...@outlook.com Subject: Re: [FFmpeg-devel] Modified force_key_frames option to accept frame numbers Le nonidi 19 brumaire, an CCXXIII, Sylvester Zaluga a écrit : ***Sending again, this time with diff*** Better use git format-patch (or git send-email), so that you have authorship and date information. Attached a patch which allows for passing in frame numbers at which key frames should be forced. The current modes in which force_key_frames operate are: * force_key_frames 1,2,3,4,5 - parameter is interpreted as timestamps * force_key_frames expr:gte(t,n_forced) - parameter is an expression The patch adds support for third mode: * force_key_frames n:0,25,50,75,100 - interpret parameter as frame numbers I find this useful for avoiding float precision-related issues that surface when key frames are forced at specified timestamps. I will not actually oppose the feature, but every time people insist on working with frame numbers instead of timestamp, I feel they are doing something incorrectly. In this particular case, you can easily work around the floating point rounding issues, since the rounding behaviour of -force_key_frames is specified: more precisely at the first frames after each specified time. You just have to make sure your timestamps are rounded down. For example, with 24000/1001 FPS: 4.21 4.25 4.30* 4.34 4.38, you need to write 4.29, not 4.30, but you can also write any value between 4.25425 and the actual 4.295958333. (4.25+4.30)/2 = 4.275 should always work. You are right, this should probably work, although, in use cases like mine (when the key frames have to be inserted at exact indexes, not times, in multiple videos), I still find it more natural and practical to just use frame numbers (because all the frame time transformations you describe essentially boil down to doing exactly that). This would also make it more consistent with other option -segment_frames which already accepts frame numbers. My use case is as follows: * generate output video with settings for HD video * extract key frame numbers from HD video * generate SD video with key frames at identical positions * In my application, do video LODing by switching HD/SD video depending on bandwith What happens if, in order to lower even more the SD bitrate, you decide to add the decimate filter? Frame numbers are jumbled, while timestamps are preserved. Working with frame numbers is fragile. You are right, in such cases working with timestamps makes more sense. Obviously different scenarios require different approaches. In my case I need to generate multiple videos of different quality, but with the same number of key frames at the same indexes (hence I would avoid the decimate filter). (Also, note that with some codecs, forcing a lot of keyframes will have a dramatic effect on the efficiency of the encoding.) I am aware of that. I am letting ffmpeg decide where to put key frames in the first video, and only force key frames in lower resolution videos, at the same indices as in the first one (so I am not forcing too many of them, I believe). Regards, -- Nicolas George Regards, Sylwester Zaluga ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavfi/ebur128: add support for smaller video sizes
Signed-off-by: Marton Balint c...@passwd.hu --- doc/filters.texi| 4 ++-- libavfilter/f_ebur128.c | 11 --- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 53f4cb2..713989c 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10146,8 +10146,8 @@ activated. Default is @code{0}. @item size Set the video size. This option is for video only. For the syntax of this -option, check the Video size section in the ffmpeg-utils manual. Default -and minimum resolution is @code{640x480}. +option, check the Video size section in the ffmpeg-utils manual. The default +resolution is @code{640x480}, the minimum is @code{480x102}. @item meter Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index c18ae79..8780062 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -114,6 +114,7 @@ typedef struct { int scale_range;/// the range of LU values according to the meter int y_zero_lu; /// the y value (pixel position) for 0 LU int *y_line_ref;/// y reference values for drawing the LU lines in the graph and the gauge +int line_step; /// LU steps for drawn lines /* audio */ int nb_channels;/// number of channels in the input @@ -257,9 +258,9 @@ static int config_video_output(AVFilterLink *outlink) AVFrame *outpicref; /* check if there is enough space to represent everything decently */ -if (ebur128-w 640 || ebur128-h 480) { +if (ebur128-w 480 || ebur128-h 102) { av_log(ctx, AV_LOG_ERROR, Video size %dx%d is too small, - minimum size is 640x480\n, ebur128-w, ebur128-h); + minimum size is 480x102\n, ebur128-w, ebur128-h); return AVERROR(EINVAL); } outlink-w = ebur128-w; @@ -285,6 +286,9 @@ static int config_video_output(AVFilterLink *outlink) ebur128-graph.w = ebur128-gauge.x - ebur128-graph.x - PAD; ebur128-graph.h = ebur128-gauge.h; +/* compute line step based on graph height and needed lines */ +ebur128-line_step = (ebur128-scale_range * 8 - 1) / (ebur128-graph.h) + 1; + /* graph and gauge share the LU-to-pixel code */ av_assert0(ebur128-graph.h == ebur128-gauge.h); @@ -309,8 +313,9 @@ static int config_video_output(AVFilterLink *outlink) for (i = ebur128-meter; i = -ebur128-meter * 2; i--) { y = lu_to_y(ebur128, i); x = PAD + (i 10 i -10) * 8; -ebur128-y_line_ref[y] = i; +ebur128-y_line_ref[y] = ((i % ebur128-line_step == 0) ? i : 0); y -= 4; // -4 to center vertically +if (i % ebur128-line_step == 0) drawtext(outpicref, x, y + ebur128-graph.y, FONT8, font_colors+3, %c%d, i 0 ? '-' : i 0 ? '+' : ' ', FFABS(i)); } -- 2.1.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] lavfi/ebur128: fix indentation after last commit
Signed-off-by: Marton Balint c...@passwd.hu --- libavfilter/f_ebur128.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 8780062..63b4dad 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -316,8 +316,8 @@ static int config_video_output(AVFilterLink *outlink) ebur128-y_line_ref[y] = ((i % ebur128-line_step == 0) ? i : 0); y -= 4; // -4 to center vertically if (i % ebur128-line_step == 0) -drawtext(outpicref, x, y + ebur128-graph.y, FONT8, font_colors+3, - %c%d, i 0 ? '-' : i 0 ? '+' : ' ', FFABS(i)); +drawtext(outpicref, x, y + ebur128-graph.y, FONT8, font_colors+3, + %c%d, i 0 ? '-' : i 0 ? '+' : ' ', FFABS(i)); } /* draw graph */ -- 2.1.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 6/9] ffserver_config: handle codec private options
Hi Lukasz. Sry for the delay at answering, been traveling the whole week. Patch looks OK, feel free to push. Bests, -- Reynaldo H. Verdejo Pinochet Open Source Group Samsung Research America / Silicon Valley ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffserver_config: do not store preset name
Looks. OK. Feel free to push after some testing. Can't try it out right now but seems harmless. Bests, -- Reynaldo H. Verdejo Pinochet Open Source Group Samsung Research America / Silicon Valley ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffserver_config: fix possible crash
OK to push. Thanks. -- Reynaldo H. Verdejo Pinochet Open Source Group Samsung Research America / Silicon Valley ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffserver_config: fix possible crash
On 16.11.2014 23:41, Reynaldo H. Verdejo Pinochet wrote: OK to push. Thanks. Pushed both ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] h264_i386: Optimize decode_significance_8x8_x86 for 64 bit.
On Sat, Nov 15, 2014 at 06:16:03PM +0100, Reimar Döffinger wrote: 11674 - 10877 decicycles on my Phenom II. Overall speedup was unfortunately within measurement error. here its 10153 -10135 but ive a slightly odd feeling about the chnages to the asm code, iam not sure if all assemblers will be happy about the changed code [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 01/11] ffserver_config: cosmetic: simplify functions calls.
ffserver_save_avoption() and ffserver_opt_preset() have redundant arguments. They can be obtained basing on media type. This simplifies uses and reduce chance for a mistake. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver_config.c | 91 +++ 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index 02c8431..6b80f02 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -31,8 +31,8 @@ #include cmdutils.h #include ffserver_config.h -static int ffserver_save_avoption(AVCodecContext *ctx, const char *opt, const char *arg, - AVDictionary **dict, int type, FFServerConfig *config, int line_num); +static int ffserver_save_avoption(const char *opt, const char *arg, int type, + FFServerConfig *config, int line_num); static void vreport_config_error(const char *filename, int line_num, int log_level, int *errors, const char *fmt, va_list vl); static void report_config_error(const char *filename, int line_num, int log_level, @@ -274,12 +274,25 @@ static int ffserver_set_codec(AVCodecContext *ctx, const char *codec_name, FFSer return 0; } -static int ffserver_opt_preset(const char *arg, AVCodecContext *avctx, FFServerConfig *config, int line_num) +static int ffserver_opt_preset(const char *arg, int type, FFServerConfig *config, int line_num) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; int ret = 0; -AVCodec *codec = avcodec_find_encoder(avctx-codec_id); +AVCodecContext *avctx; +const AVCodec *codec; + +switch(type) { +case AV_OPT_FLAG_AUDIO_PARAM: +avctx = config-dummy_actx; +break; +case AV_OPT_FLAG_VIDEO_PARAM: +avctx = config-dummy_vctx; +break; +default: +av_assert0(0); +} +codec = avcodec_find_encoder(avctx-codec_id); if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, codec ? codec-name : NULL))) { @@ -306,29 +319,10 @@ static int ffserver_opt_preset(const char *arg, AVCodecContext *avctx, FFServerC av_log(NULL, AV_LOG_ERROR, Subtitles preset found.\n); ret = AVERROR(EINVAL); break; -} else { -int type; -AVDictionary **opts; - -switch(avctx-codec_type) { -case AVMEDIA_TYPE_AUDIO: -type = AV_OPT_FLAG_AUDIO_PARAM; -opts = config-audio_opts; -break; -case AVMEDIA_TYPE_VIDEO: -type = AV_OPT_FLAG_VIDEO_PARAM; -opts = config-video_opts; -break; -default: -ret = AVERROR(EINVAL); -goto exit; -} -if (ffserver_save_avoption(avctx, tmp, tmp2, opts, type, config, line_num) 0) -break; -} +} else if (ffserver_save_avoption(tmp, tmp2, type, config, line_num) 0) +break; } - exit: fclose(f); return ret; @@ -430,8 +424,7 @@ static int ffserver_set_float_param(float *dest, const char *value, float factor return AVERROR(EINVAL); } -static int ffserver_save_avoption(AVCodecContext *ctx, const char *opt, const char *arg, AVDictionary **dict, - int type, FFServerConfig *config, int line_num) +static int ffserver_save_avoption(const char *opt, const char *arg, int type, FFServerConfig *config, int line_num) { static int hinted = 0; int ret = 0; @@ -440,6 +433,26 @@ static int ffserver_save_avoption(AVCodecContext *ctx, const char *opt, const ch const char *option = NULL; const char *codec_name = NULL; char buff[1024]; +AVCodecContext *ctx; +AVDictionary **dict; +enum AVCodecID guessed_codec_id; + +switch (type) { +case AV_OPT_FLAG_VIDEO_PARAM: +ctx = config-dummy_vctx; +dict = config-video_opts; +guessed_codec_id = config-guessed_video_codec_id != AV_CODEC_ID_NONE ? + config-guessed_video_codec_id : AV_CODEC_ID_H264; +break; +case AV_OPT_FLAG_AUDIO_PARAM: +ctx = config-dummy_actx; +dict = config-audio_opts; +guessed_codec_id = config-guessed_audio_codec_id != AV_CODEC_ID_NONE ? + config-guessed_audio_codec_id : AV_CODEC_ID_AAC; +break; +default: +av_assert0(0); +} if (strchr(opt, ':')) { //explicit private option @@ -461,23 +474,11 @@ static int ffserver_save_avoption(AVCodecContext *ctx, const char *opt, const ch report_config_error(config-filename, line_num, AV_LOG_ERROR, config-errors, Option not found: %s\n, opt); if (!hinted ctx-codec_id == AV_CODEC_ID_NONE) { -enum AVCodecID id;
[FFmpeg-devel] [PATCH 04/11] ffserver_config: remove ffserver_apply_stream_config function
This function became very short and can be logically merged with add_codec(). Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver_config.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index 2ac159b..b372e4a 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -174,13 +174,20 @@ void ffserver_parse_acl_row(FFServerStream *stream, FFServerStream* feed, } /* add a codec and set the default parameters */ -static void add_codec(FFServerStream *stream, AVCodecContext *av) +static void add_codec(FFServerStream *stream, AVCodecContext *av, FFServerConfig *config) { AVStream *st; +AVDictionary **opts; if(stream-nb_streams = FF_ARRAY_ELEMS(stream-streams)) return; +opts = av-codec_type == AVMEDIA_TYPE_AUDIO ? config-audio_opts : config-video_opts; +av_opt_set_dict2(av-priv_data, opts, AV_OPT_SEARCH_CHILDREN); +av_opt_set_dict2(av, opts, AV_OPT_SEARCH_CHILDREN); +if (av_dict_count(*opts)) +av_log(NULL, AV_LOG_ERROR, Something went wrong, %d options not set!!!\n, av_dict_count(*opts)); + /* compute default parameters */ switch(av-codec_type) { case AVMEDIA_TYPE_AUDIO: @@ -683,14 +690,6 @@ static int ffserver_parse_config_feed(FFServerConfig *config, const char *cmd, c return 0; } -static void ffserver_apply_stream_config(AVCodecContext *enc, AVDictionary **opts) -{ -av_opt_set_dict2(enc-priv_data, opts, AV_OPT_SEARCH_CHILDREN); -av_opt_set_dict2(enc, opts, AV_OPT_SEARCH_CHILDREN); -if (av_dict_count(*opts)) -av_log(NULL, AV_LOG_ERROR, Something went wrong, %d options not set!!!\n, av_dict_count(*opts)); -} - static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, const char **p, FFServerStream **pstream) { @@ -1012,15 +1011,13 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, config-dummy_actx-codec_id = config-guessed_audio_codec_id; if (!config-no_audio config-dummy_actx-codec_id != AV_CODEC_ID_NONE) { AVCodecContext *audio_enc = avcodec_alloc_context3(avcodec_find_encoder(config-dummy_actx-codec_id)); -ffserver_apply_stream_config(audio_enc, config-audio_opts); -add_codec(stream, audio_enc); +add_codec(stream, audio_enc, config); } if (config-dummy_vctx-codec_id == AV_CODEC_ID_NONE) config-dummy_vctx-codec_id = config-guessed_video_codec_id; if (!config-no_video config-dummy_vctx-codec_id != AV_CODEC_ID_NONE) { AVCodecContext *video_enc = avcodec_alloc_context3(avcodec_find_encoder(config-dummy_vctx-codec_id)); -ffserver_apply_stream_config(video_enc, config-video_opts); -add_codec(stream, video_enc); +add_codec(stream, video_enc, config); } } av_dict_free(config-video_opts); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 06/11] [WIP][RFC]tools: add ffserver_config_test
Work in progress... Need support Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- Makefile | 4 +- ffserver_config.c| 40 ++ ffserver_config.h| 7 ++ tools/ffserver_config_test.c | 178 +++ 4 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 tools/ffserver_config_test.c diff --git a/Makefile b/Makefile index 1e1dbb3..41fd6c5 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ OBJS-ffserver += ffserver_config.o TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options -TOOLS = qt-faststart trasher uncoded_frame +TOOLS = qt-faststart trasher uncoded_frame ffserver_config_test TOOLS-$(CONFIG_ZLIB) += cws2fws # $(FFLIBS-yes) needs to be in linking order @@ -69,6 +69,8 @@ $(TOOLS): %$(EXESUF): %.o $(EXEOBJS) tools/cws2fws$(EXESUF): ELIBS = $(ZLIB) tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS) tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS) +tools/ffserver_config_test$(EXESUF): $(FF_DEP_LIBS) +tools/ffserver_config_test$(EXESUF): ELIBS = ffserver_config.o cmdutils.o $(FF_DEP_LIBS) -lm config.h: .config .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) diff --git a/ffserver_config.c b/ffserver_config.c index 355111c..511752b 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -1205,3 +1205,43 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) #undef ERROR #undef WARNING + +static void ffserver_free_server_stream(FFServerStream *stream) +{ +int i; + +av_dict_free(stream-in_opts); +av_dict_free(stream-metadata); +while(stream-acl) { +FFServerIPAddressACL *acl = stream-acl; +stream-acl = acl-next; +av_free(acl); +} +for (i = 0; i stream-nb_streams; i++) { +avcodec_free_context(stream-streams[i]-codec); +av_free(stream-streams[i]); +} +av_free(stream); +} + +void ffserver_free_config(FFServerConfig *config) +{ +FFServerStream *st; + +if (!config) +return; + +config-first_feed = NULL; +while (config-first_stream) { +st = config-first_stream; +config-first_stream = st-next; +ffserver_free_server_stream(st); +} +av_freep(config-filename); + +//make sure config parser state is also freed +av_dict_free(config-video_opts); +av_dict_free(config-audio_opts); +avcodec_free_context(config-dummy_vctx); +avcodec_free_context(config-dummy_actx); +} diff --git a/ffserver_config.h b/ffserver_config.h index 4e1e0e0..b62a6b7 100644 --- a/ffserver_config.h +++ b/ffserver_config.h @@ -128,4 +128,11 @@ void ffserver_parse_acl_row(FFServerStream *stream, FFServerStream* feed, int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config); +/** + * Deallocate all memory used by the config + * + * @param config ffserver configuration + */ +void ffserver_free_config(FFServerConfig *config); + #endif /* FFSERVER_CONFIG_H */ diff --git a/tools/ffserver_config_test.c b/tools/ffserver_config_test.c new file mode 100644 index 000..0680d39 --- /dev/null +++ b/tools/ffserver_config_test.c @@ -0,0 +1,178 @@ + +#include libavutil/avassert.h +#include libavutil/opt.h +#include ../ffserver_config.h + +const char *program_name=; +const int program_birth_year=2014; +void show_help_default(const char *opt, const char *arg); +void show_help_default(const char *opt, const char *arg) +{ +} + +static int dummy_encode(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) +{ +return -1; +} + +AVCodec dummy_v_encoder = { +.name = dummy_v_codec, +.type = AVMEDIA_TYPE_VIDEO, +.id = AV_CODEC_ID_NONE - 1, +.encode2 = dummy_encode, +}; + +AVCodec dummy_a_encoder = { +.name = dummy_a_codec, +.type = AVMEDIA_TYPE_AUDIO, +.id = AV_CODEC_ID_NONE - 2, +.encode2 = dummy_encode, +}; + +static const char *config_file = /tmp/__test_config.txt; + +static struct { +const char *key; +const char *value; +} alias_stream_options[] = { +//common +{Debug, 1}, +{Strict, -2}, +//audio +{AudioBitRate, 192}, +{AudioChannels, 4}, +{AudioSampleRate,22050}, +//video +{VideoBitRateRange, 1000-2000}, +{VideoBufferSize,4}, +{VideoBitRateTolerance, 500}, +{VideoBitRate, 1500}, +{VideoSize, 1280x720}, +{VideoFrameRate, 25}, +{PixelFormat,yuv420p}, +{VideoGopSize, 4}, +{VideoIntraOnly, }, +{VideoHighQuality, }, +{Video4MotionVector, }, +{VideoTag, XVID}, +{BitExact, }, +{DctFastint, }, +{IdctSimple, }, +
[FFmpeg-devel] [PATCH 07/11] lavu/dict: add av_dict_serialize
TODO: bump minor, update doc/APIchanges Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- libavutil/dict.c | 27 +++ libavutil/dict.h | 16 2 files changed, 43 insertions(+) diff --git a/libavutil/dict.c b/libavutil/dict.c index 475e906..a41d61e 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -24,6 +24,7 @@ #include dict.h #include internal.h #include mem.h +#include bprint.h struct AVDictionary { int count; @@ -207,3 +208,29 @@ void av_dict_copy(AVDictionary **dst, FF_CONST_AVUTIL53 AVDictionary *src, int f while ((t = av_dict_get(src, , t, AV_DICT_IGNORE_SUFFIX))) av_dict_set(dst, t-key, t-value, flags); } + +int av_dict_serialize(const AVDictionary *m, char **buffer, + const char pairs_sep, const char key_val_sep) +{ +AVDictionaryEntry *t = NULL; +AVBPrint bprint; +int cnt = 0; + +if (!m || !buffer) +return AVERROR(EINVAL); + +if (!av_dict_count(m)) { +*buffer = av_strdup(); +return *buffer ? 0 : AVERROR(ENOMEM); +} + +av_bprint_init(bprint, 64, AV_BPRINT_SIZE_UNLIMITED); + +while ((t = av_dict_get(m, , t, AV_DICT_IGNORE_SUFFIX))) { +if (cnt++) +av_bprint_append_data(bprint, pairs_sep, 1); +av_bprintf(bprint, %s%c%s, t-key, key_val_sep, t-value); +} + +return av_bprint_finalize(bprint, buffer); +} diff --git a/libavutil/dict.h b/libavutil/dict.h index 9b3381b..6088837 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -172,6 +172,22 @@ void av_dict_copy(AVDictionary **dst, FF_CONST_AVUTIL53 AVDictionary *src, int f void av_dict_free(AVDictionary **m); /** + * Serialize a dictionary. + * + * Create a string containing dictionary's serialized entries. + * Such string may be passed back to av_dict_parse_string(). + * + * @param[in] m dictionary to serialize + * @param[out] bufferPointer to buffer that will be allocated with string containg serialized entries. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep character used to separate key from value + * @param[in] pairs_sep character used to separate two pairs from each other + * @return = 0 on success, negative on error + */ +int av_dict_serialize(const AVDictionary *m, char **buffer, + const char pairs_sep, const char key_val_sep); + +/** * @} */ -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 09/11] lavf/ffmdec: add common options to recommended encoder configuration
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- libavformat/ffmdec.c | 36 +++- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 7ae906b..987f419 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -24,6 +24,8 @@ #include libavutil/intreadwrite.h #include libavutil/intfloat.h #include libavutil/opt.h +#include libavutil/avassert.h +#include libavutil/avstring.h #include avformat.h #include internal.h #include ffm.h @@ -231,6 +233,27 @@ static int ffm_close(AVFormatContext *s) return 0; } +static int ffm_append_recommended_configuration(AVStream *st, char **conf) +{ +int ret; +size_t newsize; +av_assert0(conf st); +if (!*conf) +return 0; +if (!st-recommended_encoder_configuration) { +st-recommended_encoder_configuration = *conf; +*conf = 0; +return 0; +} +newsize = strlen(*conf) + strlen(st-recommended_encoder_configuration) + 2; +if ((ret = av_reallocp(st-recommended_encoder_configuration, newsize)) 0) +return ret; +av_strlcat(st-recommended_encoder_configuration, ,, newsize); +av_strlcat(st-recommended_encoder_configuration, *conf, newsize); +av_freep(conf); +return 0; +} + static int ffm2_read_header(AVFormatContext *s) { FFMContext *ffm = s-priv_data; @@ -367,12 +390,14 @@ static int ffm2_read_header(AVFormatContext *s) } enc = avcodec_find_encoder(codec-codec_id); if (enc enc-priv_data_size enc-priv_class) { -st-recommended_encoder_configuration = av_malloc(size + 1); -if (!st-recommended_encoder_configuration) { +buffer = av_malloc(size + 1); +if (!buffer) { ret = AVERROR(ENOMEM); goto fail; } -avio_get_str(pb, size, st-recommended_encoder_configuration, size + 1); +avio_get_str(pb, size, buffer, size + 1); +if ((ret = ffm_append_recommended_configuration(st, buffer)) 0) +goto fail; } break; case MKBETAG('S', '2', 'V', 'I'): @@ -387,7 +412,8 @@ static int ffm2_read_header(AVFormatContext *s) } avio_get_str(pb, INT_MAX, buffer, size); av_set_options_string(codec, buffer, =, ,); -av_freep(buffer); +if ((ret = ffm_append_recommended_configuration(st, buffer)) 0) +goto fail; break; case MKBETAG('S', '2', 'A', 'U'): if (f_stau++) { @@ -401,7 +427,7 @@ static int ffm2_read_header(AVFormatContext *s) } avio_get_str(pb, INT_MAX, buffer, size); av_set_options_string(codec, buffer, =, ,); -av_freep(buffer); +ffm_append_recommended_configuration(st, buffer); break; } avio_seek(pb, next, SEEK_SET); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 10/11] lavf/ffmenc: store recommended encoder configuration
ffmenc will store recommended encoder configuration if present. This will allow the user to base on local defaults and apply only explicitly set options. If recommended encoder configuration is not present, then non-default context's options are stored. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- libavformat/ffmenc.c | 74 +--- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index b717813..2f3f90d 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -162,6 +162,60 @@ static int ffm_write_header_codec_ctx(AVIOContext *pb, AVCodecContext *ctx, unsi #undef ENC } +static int ffm_write_recommended_config(AVIOContext *pb, AVCodecContext *ctx, unsigned tag, +const char *configuration) +{ +int ret; +const AVCodec *enc = ctx-codec ? ctx-codec : avcodec_find_encoder(ctx-codec_id); +AVIOContext *tmp; +AVDictionaryEntry *t = NULL; +AVDictionary *all = NULL, *comm = NULL, *prv = NULL; +char *buf = NULL; + +if (!enc || !enc-priv_class || !enc-priv_data_size) { +/* codec is not known/has no private options, so save everything as common options */ +if (avio_open_dyn_buf(tmp) 0) +return AVERROR(ENOMEM); +avio_put_str(tmp, configuration); +write_header_chunk(pb, tmp, tag); +return 0; +} + +if ((ret = av_dict_parse_string(all, configuration, =, ,, 0)) 0) +return ret; + +while ((t = av_dict_get(all, , t, AV_DICT_IGNORE_SUFFIX))) { +if (av_opt_find((void *)enc-priv_class, t-key, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)) { +if ((ret = av_dict_set(prv, t-key, t-value, 0)) 0) +goto fail; +} else if ((ret = av_dict_set(comm, t-key, t-value, 0)) 0) +goto fail; +} + +if (comm) { +if ((ret = av_dict_serialize(comm, buf, ',', '=')) 0 || +(ret = avio_open_dyn_buf(tmp)) 0) +goto fail; +avio_put_str(tmp, buf); +av_freep(buf); +write_header_chunk(pb, tmp, tag); +} +if (prv) { +if ((ret = av_dict_serialize(prv, buf, ',', '=')) 0 || +(ret = avio_open_dyn_buf(tmp)) 0) +goto fail; +avio_put_str(tmp, buf); +write_header_chunk(pb, tmp, MKBETAG('C', 'P', 'R', 'V')); +} + + fail: +av_free(buf); +av_dict_free(all); +av_dict_free(comm); +av_dict_free(prv); +return ret; +} + static int ffm_write_header(AVFormatContext *s) { FFMContext *ffm = s-priv_data; @@ -222,13 +276,25 @@ static int ffm_write_header(AVFormatContext *s) /* specific info */ switch(codec-codec_type) { case AVMEDIA_TYPE_VIDEO: -if ((ret = ffm_write_header_codec_ctx(s-pb, codec, MKBETAG('S', '2', 'V', 'I'), AV_OPT_FLAG_VIDEO_PARAM)) 0 || -(ret = ffm_write_header_codec_private_ctx(s-pb, codec, AV_OPT_FLAG_VIDEO_PARAM)) 0) +if (st-recommended_encoder_configuration) { +av_log(NULL, AV_LOG_DEBUG, writing recommended configuration: %s\n, + st-recommended_encoder_configuration); +if ((ret = ffm_write_recommended_config(s-pb, codec, MKBETAG('S', '2', 'V', 'I'), + st-recommended_encoder_configuration)) 0) +return ret; +} else if ((ret = ffm_write_header_codec_ctx(s-pb, codec, MKBETAG('S', '2', 'V', 'I'), AV_OPT_FLAG_VIDEO_PARAM)) 0 || + (ret = ffm_write_header_codec_private_ctx(s-pb, codec, AV_OPT_FLAG_VIDEO_PARAM)) 0) return ret; break; case AVMEDIA_TYPE_AUDIO: -if ((ret = ffm_write_header_codec_ctx(s-pb, codec, MKBETAG('S', '2', 'A', 'U'), AV_OPT_FLAG_AUDIO_PARAM)) 0 || -(ret = ffm_write_header_codec_private_ctx(s-pb, codec, AV_OPT_FLAG_AUDIO_PARAM)) 0) +if (st-recommended_encoder_configuration) { +av_log(NULL, AV_LOG_DEBUG, writing recommended configuration: %s\n, + st-recommended_encoder_configuration); +if ((ret = ffm_write_recommended_config(s-pb, codec, MKBETAG('S', '2', 'A', 'U'), + st-recommended_encoder_configuration)) 0) +return ret; +} else if ((ret = ffm_write_header_codec_ctx(s-pb, codec, MKBETAG('S', '2', 'A', 'U'), AV_OPT_FLAG_AUDIO_PARAM)) 0 || + (ret = ffm_write_header_codec_private_ctx(s-pb, codec, AV_OPT_FLAG_AUDIO_PARAM)) 0) return ret; break; default: -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 08/11] ffserver: export recommented encoder configuration
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver.c| 6 +++-- ffserver_config.c | 77 ++- 2 files changed, 63 insertions(+), 20 deletions(-) diff --git a/ffserver.c b/ffserver.c index e24243d..3702fd6 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3326,8 +3326,7 @@ static int add_av_stream(FFServerStream *feed, AVStream *st) av = st-codec; for(i=0;ifeed-nb_streams;i++) { -st = feed-streams[i]; -av1 = st-codec; +av1 = feed-streams[i]-codec; if (av1-codec_id == av-codec_id av1-codec_type == av-codec_type av1-bit_rate == av-bit_rate) { @@ -3355,6 +3354,9 @@ static int add_av_stream(FFServerStream *feed, AVStream *st) fst = add_av_stream1(feed, av, 0); if (!fst) return -1; +if (av_stream_get_recommended_encoder_configuration(st)) +av_stream_set_recommended_encoder_configuration(fst, +av_strdup(av_stream_get_recommended_encoder_configuration(st))); return feed-nb_streams - 1; } diff --git a/ffserver_config.c b/ffserver_config.c index 511752b..d7c7c1c 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -177,12 +177,14 @@ void ffserver_parse_acl_row(FFServerStream *stream, FFServerStream* feed, static void add_codec(FFServerStream *stream, AVCodecContext *av, FFServerConfig *config) { AVStream *st; -AVDictionary **opts; +AVDictionary **opts, *recommended = NULL; +char *enc_config; if(stream-nb_streams = FF_ARRAY_ELEMS(stream-streams)) return; opts = av-codec_type == AVMEDIA_TYPE_AUDIO ? config-audio_opts : config-video_opts; +av_dict_copy(recommended, *opts, 0); av_opt_set_dict2(av-priv_data, opts, AV_OPT_SEARCH_CHILDREN); av_opt_set_dict2(av, opts, AV_OPT_SEARCH_CHILDREN); if (av_dict_count(*opts)) @@ -193,63 +195,99 @@ static void add_codec(FFServerStream *stream, AVCodecContext *av, FFServerConfig /* compute default parameters */ switch(av-codec_type) { case AVMEDIA_TYPE_AUDIO: -if (av-bit_rate == 0) +if (av-bit_rate == 0) { av-bit_rate = 64000; -if (av-sample_rate == 0) +av_dict_set_int(recommended, ab, av-bit_rate, 0); +} +if (av-sample_rate == 0) { av-sample_rate = 22050; -if (av-channels == 0) +av_dict_set_int(recommended, ar, av-sample_rate, 0); +} +if (av-channels == 0) { av-channels = 1; +av_dict_set_int(recommended, ac, av-channels, 0); +} break; case AVMEDIA_TYPE_VIDEO: -if (av-bit_rate == 0) +if (av-bit_rate == 0) { av-bit_rate = 64000; +av_dict_set_int(recommended, b, av-bit_rate, 0); +} if (av-time_base.num == 0){ av-time_base.den = 5; av-time_base.num = 1; +av_dict_set(recommended, time_base, 1/5, 0); } if (av-width == 0 || av-height == 0) { av-width = 160; av-height = 128; +av_dict_set(recommended, video_size, 160x128, 0); } /* Bitrate tolerance is less for streaming */ -if (av-bit_rate_tolerance == 0) +if (av-bit_rate_tolerance == 0) { av-bit_rate_tolerance = FFMAX(av-bit_rate / 4, (int64_t)av-bit_rate*av-time_base.num/av-time_base.den); -if (av-qmin == 0) +av_dict_set_int(recommended, bt, av-bit_rate_tolerance, 0); +} +if (av-qmin == 0) { av-qmin = 3; -if (av-qmax == 0) +av_dict_set_int(recommended, qmin, av-qmin, 0); +} +if (av-qmax == 0) { av-qmax = 31; -if (av-max_qdiff == 0) +av_dict_set_int(recommended, qmax, av-qmax, 0); +} +if (av-max_qdiff == 0) { av-max_qdiff = 3; +av_dict_set_int(recommended, qdiff, av-max_qdiff, 0); +} +/*FIXME: 0.5 is a default for these two, it is a dead code */ av-qcompress = 0.5; +av_dict_set(recommended, qcomp, 0.5, 0); av-qblur = 0.5; +av_dict_set(recommended, qblur, 0.5, 0); -if (!av-nsse_weight) +if (!av-nsse_weight) { av-nsse_weight = 8; +av_dict_set_int(recommended, nssew, av-nsse_weight, 0); +} av-frame_skip_cmp = FF_CMP_DCTMAX; -if (!av-me_method) +av_dict_set_int(recommended, skipcmp, FF_CMP_DCTMAX, 0); +if (!av-me_method) { av-me_method = ME_EPZS; +av_dict_set_int(recommended, me_method, ME_EPZS, 0); +} /* FIXME: rc_buffer_aggressivity and rc_eq are deprecated */ av-rc_buffer_aggressivity = 1.0; +av_dict_set(recommended, rc_buf_aggressivity, 1.0, 0); -if (!av-rc_eq) +if (!av-rc_eq) { av-rc_eq =
[FFmpeg-devel] [PATCH 11/11] ffmpeg_opt: make use of recommended encoder configuration
So far ffmpeg used recommended configuration only for codec priv options. ffmpeg will use now codec defaults and then apply recommended configuration for all options. Recommended configuration possibly contains minimal set of options to filful user configuration. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffmpeg_opt.c | 41 - 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 85466c7..03e049b 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1617,31 +1617,6 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) return 0; } -static int ffserver_streams_copy_context(AVCodecContext *dest, const AVCodecContext *src, - const char *configuration) -{ -int ret; -if ((ret = avcodec_copy_context(dest, src)) 0) -return ret; -dest-codec = avcodec_find_encoder(src-codec_id); -if (!dest-codec) -return AVERROR(EINVAL); -if (!dest-codec-priv_class || !dest-codec-priv_data_size) -return 0; -if (!dest-priv_data) { -dest-priv_data = av_mallocz(dest-codec-priv_data_size); -if (!dest-priv_data) -return AVERROR(ENOMEM); -*(const AVClass**)dest-priv_data = dest-codec-priv_class; -} -av_opt_set_defaults(dest-priv_data); -if (av_set_options_string(dest-priv_data, configuration, =, ,) 0) { -av_log(dest, AV_LOG_WARNING, Cannot copy private codec options. Using defaults.\n); -av_opt_set_defaults(dest-priv_data); -} -return 0; -} - static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename) { int i, err; @@ -1656,6 +1631,7 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch AVStream *st; OutputStream *ost; AVCodec *codec; +const char *enc_config; codec = avcodec_find_encoder(ic-streams[i]-codec-codec_id); if (!codec) { @@ -1669,15 +1645,22 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch ost = new_output_stream(o, s, codec-type, -1); st= ost-st; -ffserver_streams_copy_context(st-codec, ic-streams[i]-codec, - av_stream_get_recommended_encoder_configuration(ic-streams[i])); +avcodec_get_context_defaults3(st-codec, codec); +enc_config = av_stream_get_recommended_encoder_configuration(ic-streams[i]); +if (enc_config) { +AVDictionary *opts = NULL; +av_dict_parse_string(opts, enc_config, =, ,, 0); +av_opt_set_dict2(st-codec, opts, AV_OPT_SEARCH_CHILDREN); +av_dict_free(opts); +} if (st-codec-codec_type == AVMEDIA_TYPE_AUDIO !ost-stream_copy) choose_sample_fmt(st, codec); else if (st-codec-codec_type == AVMEDIA_TYPE_VIDEO !ost-stream_copy) choose_pixel_fmt(st, st-codec, codec, st-codec-pix_fmt); -ffserver_streams_copy_context(ost-enc_ctx, st-codec, - av_stream_get_recommended_encoder_configuration(ic-streams[i])); +avcodec_copy_context(ost-enc_ctx, st-codec); +if (enc_config) +av_dict_parse_string(ost-encoder_opts, enc_config, =, ,, 0); } avformat_close_input(ic); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 03/11] ffserver_config: map ffserver options to AVOptions
On 17.11.2014 02:46, Lukasz Marek wrote: Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffserver_config.c | 237 -- ffserver_config.h | 2 - 2 files changed, 69 insertions(+), 170 deletions(-) @Reynaldo, you may check the test I submitted, and the comments, you may then have just high level review, not bother if mapping between options is ok ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 11/11] ffmpeg_opt: make use of recommended encoder configuration
On 17.11.2014 02:46, Lukasz Marek wrote: So far ffmpeg used recommended configuration only for codec priv options. ffmpeg will use now codec defaults and then apply recommended configuration for all options. Recommended configuration possibly contains minimal set of options to filful user configuration. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- ffmpeg_opt.c | 41 - 1 file changed, 12 insertions(+), 29 deletions(-) whole patchset on my github, master branch ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] h264_i386: Optimize decode_significance_8x8_x86 for 64 bit.
On 17.11.2014, at 02:37, Michael Niedermayer michae...@gmx.at wrote: On Sat, Nov 15, 2014 at 06:16:03PM +0100, Reimar Döffinger wrote: 11674 - 10877 decicycles on my Phenom II. Overall speedup was unfortunately within measurement error. here its 10153 -10135 I suspect it also depends a bit on the compiler and how it changes the surrounding code. Note that I also tested with PIC actually. but ive a slightly odd feeling about the chnages to the asm code, iam not sure if all assemblers will be happy about the changed code Do you mean particularly the movzbl change? I am also unsure about that, I think there was a reason for that %k6 mess... But this as well as movzx seemed to work for me... ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel