[Ffmpeg-devel] [PATCH] Add Dirac support to ffmpeg]

Michael Niedermayer michaelni
Tue Sep 20 22:00:10 CEST 2005


Hi

On Tue, Sep 20, 2005 at 04:55:24PM +0100, Andrew Kennedy wrote:
> Hi
> 
> At 22:19 16/09/2005, you wrote:
> >Hi
> >
> >On Fri, Sep 16, 2005 at 04:50:12PM +0100, Andrew Kennedy wrote:
> >>
> >> Hi
> >>
> >> At 11:37 02/09/2005, you wrote:
> >> >Hi
> >> >
> >> >On Tue, Aug 30, 2005 at 04:25:54PM +0100, Andrew Kennedy wrote:
> >> >> Hi,
> >> >>
> >> >> I've amended the patch in line with your recommendations. As part of 
> >the
> >> >> changes, encoding should now only work with the -2 strict option.
> >> >
> >> >thanks, but it seems i keep finding issues every time i want to apply it
> >> >so i have to annoy you again with a list of recommandet changes
> >> >
> >> >[...]
> >> >> +static int dirac_encode_frame(AVCodecContext *avccontext,
> >> >> +                              unsigned char *frame,
> >> >> +                              int buf_size, void *data)
> >> >[...]
> >> >> +    avccontext->coded_frame->pts= 0;
> >> >
> >> >this obviously is wrong, 2 frames cant have the same pts, why do you
> >> >set it at all?
> >> >
> >>
> >> This seems to have been set to avoid problems when encoding to container
> >> formats such as avi. When removed, non-monotone errors are thrown up 
> >before
> >> writing the frame. So this line of code is really more of a short-term 
> >fix.
> >> As to a cleaner implementation, I'm not sure which approach to take. Any
> >> suggestions?
> >
> >please elaborate on what you did to get non-monotone errors?
> >(with latest cvs of course)
> 
> For example, removing:
> avccontext->coded_frame->pts= 0
> ...and encoding using:
> 
> ffmpeg_g -s 720x576 -i snowboard.yuv [14 frames] -vcodec dirac -f avi -r 
> 25/1 -strict -2  output.avi
> 
> ....produces (from utils.c)
> error, non monotone timestamps 12 >= 120.5 bitrate=2430.9kbits/s
> error, non monotone timestamps 12 >= 12
> error, non monotone timestamps 12 >= 12

are you using latest ffmpeg cvs?


> 
> ..code snippet:
> if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){
>    av_log(NULL, AV_LOG_ERROR, "error, non monotone timestamps %Ld >= 
> %Ld\n", st->cur_dts, pkt->dts);
>    return -1;
> 
> However, adding in:
> avccontext->coded_frame->pts=AV_NOPTS_VALUE;
> ..to dirac_encode_frame() does not produce an error. Is this valid?

no, but better then setting it to 0

btw, i would help debug this but trying to compile ffmpeg+dirac here leads to

/home/michael/bin/colorgcc -O3 -g -Wall -Wno-switch  -DHAVE_AV_CONFIG_H -I.. -I'/home/michael/ffmpeg-write2/ffmpeg'/libavutil -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE  -I/usr/local/include/dirac    -c -o dirac.o dirac.c 
In file included from dirac.c:31:
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:167: error: syntax error before 'bool'
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:167: warning: no semicolon at end of struct or union
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:186: error: syntax error before '}' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:186: warning: type defaults to 'int' in declaration of 'dirac_encparams_t'
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:186: warning: data definition has no type or storage class
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:194: error: syntax error before 'dirac_encparams_t'
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:194: warning: no semicolon at end of struct or union
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:200: error: syntax error before '}' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:200: warning: type defaults to 'int' in declaration of 'dirac_encoder_context_t'
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:200: warning: data definition has no type or storage class
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:288: error: syntax error before '*' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:413: error: syntax error before 'dirac_encoder_context_t'
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:413: warning: no semicolon at end of struct or union
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:464: error: syntax error before '}' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:464: warning: type defaults to 'int' in declaration of 'dirac_encoder_t'
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:464: warning: data definition has no type or storage class
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:472: error: syntax error before '*' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:472: warning: type defaults to 'int' in declaration of 'dirac_encoder_context_t'
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:472: error: syntax error before '*' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:472: warning: type defaults to 'int' in declaration of 'dirac_encoder_init'
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:472: warning: data definition has no type or storage class
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:483: error: syntax error before '*' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:494: error: syntax error before '*' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:503: error: syntax error before '*' token
/usr/local/include/dirac/libdirac_encoder/dirac_encoder.h:509: error: syntax error before '*' token

colorgcc --version
gcc (GCC) 4.0.1 (Debian 4.0.1-1)

[...]
-- 
Michael





More information about the ffmpeg-devel mailing list