On 8/18/2019 3:49 AM, August Johansson wrote:
It would useful to tell us more about what you're trying to accomplish and
exactly which version(s) of ffmpeg you're using.

Because I think it would be correct to not display a duration for something
that isnt playable. And yes, I am trying to determine a file is a audio or
video or if  it is a non playable file.

A still image is "playable", it just doesn't last very long. And what does "playable" mean, anyway? A motion video might play for 6 seconds then be totally corrupt. Does that count? It really sounds like you're trying to figure out whether a file is acceptable to whatever will render it.


The quickest way to see what the format of a file is would be to use the 'file' command-

$ file /c/cpz/temp/caution-edges.jpg
/c/cpz/temp/caution-edges.jpg: JPEG image data, JFIF standard 1.02, resolution (DPCM), density 0x0, segment length 16, Exif Standard: [TIFF image data, little-endian, direntries=1], comment: "ACD Systems Digital Imaging", baseline, precision 8, 400x320, components 3


$ file /c/cpz/temp/2dbridge_93212.gif
/c/cpz/temp/2dbridge_93212.gif: GIF image data, version 89a, 1491 x 312

and parse that for a list of acceptable formats.


A second approach is to look at the _Stream_ format (as below).
A third would be to render it to a null device and look for errors.


However.... there is an interesting anomaly in the output- a jpeg file -does- return a duration while some other common still formats don't. Could because a jpeg is recognized as (presumably) the first frame of an mjpeg stream.

  Duration: 00:00:00.04, start: 0.000000, bitrate: 127698 kb/s
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1632x1224, 25 tbr, 25 tbn, 25 tbc

  Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, pal8(pc), 2157x495 [SAR 11800:11800 DAR 719:165], 25 tbr, 25 tbn, 25 tbc

  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: gif, bgra, 1491x312, 10 tbr, 100 tbn, 100 tbc

I did not exhaustively look at this.

I also don't think it's a bug, per se. Perhaps unexpected behavior, but unless the file is demuxed enough to see if there is more than one frame, a single frame jpeg and a multi-frame mjpeg will look similar/the-same.

Later,

z!

_______________________________________________
ffmpeg-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to