[FFmpeg-devel] [PATCH] ffmpeg: fail on experimental encoders if -strict > experimental

Janne Grunau janne-ffmpeg
Sat May 29 16:39:00 CEST 2010


On Wed, May 26, 2010 at 08:11:42PM +0200, Michael Niedermayer wrote:
> On Wed, May 26, 2010 at 08:03:15PM +0200, Janne Grunau wrote:
> > On Wed, May 26, 2010 at 06:56:52PM +0200, Michael Niedermayer wrote:
> > > 
> > > avcodec_opts doesnt work?
> > 
> > missed that, it works. new patch attached
> > 
> 
> >  ffmpeg.c |   30 +++++++++++++++++++++++-------
> >  1 file changed, 23 insertions(+), 7 deletions(-)
> > b0c437288e76eb893037f3b3a359d9291d4c391e  ffmpeg_fail_on_experimental_codecs.diff
> > commit ef854fc5ded795aebb0e02bbc0c67e44d4023987
> 
> looks ok if it works

with the aac decoder marked as experimental:

| ./ffmpeg -acodec aac -i test.mkv -acodec aac test.mp4
| FFmpeg version git-e231ecf, Copyright (c) 2000-2010 the FFmpeg developers
|   built on May 29 2010 15:59:43 with gcc 4.4.3
|   configuration: --enable-gpl --cpu=host --enable-libvorbis --enable-libfaad --enable-libtheora --enable-libfaac --enable-nonfree --disable-asm
|   libavutil     50.16. 0 / 50.16. 0
|   libavcodec    52.72. 0 / 52.72. 0
|   libavformat   52.67. 0 / 52.67. 0
|   libavdevice   52. 2. 0 / 52. 2. 0
|   libavfilter    1.20. 0 /  1.20. 0
|   libswscale     0.10. 0 /  0.10. 0
| decoder "aac" is experimental and might produce bad results.
| Add "-strict experimental" if you want to use it.

and for the encoder

| ./ffmpeg -i test.mkv -acodec aac test.mp4 
| FFmpeg version git-e231ecf, Copyright (c) 2000-2010 the FFmpeg developers
|   built on May 29 2010 15:59:43 with gcc 4.4.3
|   configuration: --enable-gpl --cpu=host --enable-libvorbis --enable-libfaad --enable-libtheora --enable-libfaac --enable-nonfree --disable-asm
|   libavutil     50.16. 0 / 50.16. 0
|   libavcodec    52.72. 0 / 52.72. 0
|   libavformat   52.67. 0 / 52.67. 0
|   libavdevice   52. 2. 0 / 52. 2. 0
|   libavfilter    1.20. 0 /  1.20. 0
|   libswscale     0.10. 0 /  0.10. 0
| [matroska @ 0x2a6bc70]Estimating duration from bitrate, this may be inaccurate
| 
| Seems stream 0 codec frame rate differs from container frame rate: 2997.00 (2997/1) -> 29.92 (359/12)
| Input #0, matroska, from 'test.mkv':
|   Duration: 00:00:13.37, start: 0.000000, bitrate: N/A
|     Stream #0.0: Video: mpeg4, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 29.97 fps, 29.92 tbr, 1k tbn, 2997 tbc
|     Stream #0.1: Audio: aac, 22050 Hz, stereo, s16
| encoder "aac" is experimental and might produce bad results.
| Add "-strict experimental" if you want to use it.
| Or use the non experimental encoder "libfaac".

The last line is generated by attached patch

Janne
-------------- next part --------------
commit 9b6f8c2a280006d7bb5ed10c2024fb9d0151793b
Author: Janne Grunau <janne at grunau.be>
Date:   Wed May 26 22:12:28 2010 +0200

    ffmpeg: offer alternatives for experimental codecs if they exist

diff --git a/ffmpeg.c b/ffmpeg.c
index 4c1e1b2..171897d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3091,6 +3091,12 @@ static enum CodecID find_codec_or_die(const char *name, int type, int encoder, i
         fprintf(stderr, "%s \"%s\" is experimental and might produce bad "
                 "results.\nAdd \"-strict experimental\" if you want to use it.\n",
                 codec_string, codec->name);
+        codec = encoder ?
+            avcodec_find_encoder(codec->id) :
+            avcodec_find_decoder(codec->id);
+        if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
+            fprintf(stderr, "Or use the non experimental %s \"%s\".\n",
+                    codec_string, codec->name);
         av_exit(1);
     }
     return codec->id;



More information about the ffmpeg-devel mailing list