[FFmpeg-trac] #921(FFprobe:open): ffprobe may not correctly format json filesizes (patch attached)

FFmpeg trac at avcodec.org
Wed Jan 18 01:03:32 CET 2012


#921: ffprobe may not correctly format json filesizes (patch attached)
---------------------------------------+-----------------------------------
             Reporter:  elkq           |                    Owner:  stefano
                 Type:  defect         |                   Status:  open
             Priority:  normal         |                Component:  FFprobe
              Version:  git-master     |               Resolution:
             Keywords:  json filesize  |               Blocked By:
             Blocking:                 |  Reproduced by developer:  0
Analyzed by developer:  1              |
---------------------------------------+-----------------------------------

Comment (by elkq):

 Replying to [comment:2 saste]:
 > Replying to [ticket:921 elkq]:
 > > Filesizes greater than 2GB are not always json formatted as expected,
 (smaller files are fine) for example:
 > >
 > > ffprobe -show_format -print_format json plus2GB.avi
 > [...]
 > > the -prefix option has similar unexpected behaviour.
 >
 > I noticed the patch only after I already committed a fix, which is very
 similar to yours so sorry for not crediting (and you're right, maybe I
 should also change the size of the index).
 >
 > Anyway should be fixed in:
 > {{{
 > commit 54661219c12905e70ea360b8aab1386438cae99d
 > Author: Stefano Sabatini <stefasab at gmail.com>
 > Date:   Wed Jan 18 00:01:07 2012 +0100
 >
 >     ffprobe: fix printing of unit values which cannot be contained in an
 int
 >
 >     Use long long int to contain such values instead of an int, which is
 >     required to contain at least 64 bits, so it is guaranteed to contain
 also
 >     int64_t values, which are used by some fields.
 >
 >     In particular, should fix trac ticket #921.
 > }}}
 >
 > Please confirm that it is fixed, thanks for the report&patch.

 Unfortunately we missed a case, the -unit option, i.e.:
 $ ffprobe -unit -show_format -print_format json plus2GB.avi

 So we probably also need to change line 129:
 {{{
  - else            l = snprintf(buf, buf_size, "%d",   (int)vald);
  + else            l = snprintf(buf, buf_size, "%lld",   (long long
 int)vald);
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/921#comment:3>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list