Opened 5 years ago

Closed 5 years ago

#398 closed defect (fixed)

ffplay does not initialize dar/sar for scale filter

Reported by: rectalogic Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

The 'sar' and 'dar' expressions available in the scale filter are not initialized properly in ffplay. I have a sample video sar43.mpg (download from http://www.box.net/shared/jdtkdlhsvres106e157z) that is 1440x1080 with SAR of 4:3 and so DAR of 16:9. When the scale filter expression is parsed, 'sar' is 1 and 'dar' is 1.333 (4:3) because inlink->sample_aspect_ratio is {0,1} instead of {4,3}.

gdb info from breakpoint in libavfilter/vf_scale.c:config_props()

(gdb) p var_values[VAR_SAR]
$32 = 1
(gdb) p var_values[VAR_DAR]
$33 = 1.3333333730697632
(gdb) p inlink->sample_aspect_ratio
$34 = {num = 0, den = 1}

ffplay output:

$ ./ffplay -vf scale=600*dar:600 /storage/test/mencoder/sar43.mpg
ffplay version N-31895-gee5234d, Copyright (c) 2003-2011 the FFmpeg developers
  built on Aug 14 2011 23:40:42 with gcc 4.4.3
  configuration: --enable-debug=gdb3 --disable-optimizations --disable-asm --disable-stripping
  libavutil    51. 12. 0 / 51. 12. 0
  libavcodec   53. 10. 0 / 53. 10. 0
  libavformat  53.  7. 0 / 53.  7. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 31. 1 /  2. 31. 1
  libswscale    2.  0. 0 /  2.  0. 0
Input #0, mpeg, from '/storage/test/mencoder/sar43.mpg':
  Duration: 00:00:03.06, start: 0.157667, bitrate: 27326 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], 28000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
[scale @ 0x2897e60] w:1440 h:1080 fmt:yuv420p -> w:800 h:600 fmt:yuv420p flags:0x4

I think ffplay needs to insert a 'buffer' filter before 'scale' like ffmpeg does?

Change History (1)

comment:1 Changed 5 years ago by saste

  • Analyzed by developer set
  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in commit:

commit f8eaa006b61413afa3d8434eef0a2fe7d76f0097
Author: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Date:   Tue Aug 16 17:26:31 2011 +0200

    ffplay: in input_config_props(), honour the SAR specified in the codec context
    
    Use the value specified in the codec context for setting the
    filterchain sample aspect ratio, when it is not specified in the
    stream context.
    
    Consistent with the ffmpeg behavior.
    
    Fix trac issue #398.
Note: See TracTickets for help on using tickets.