Skip to content

What should be the video size/width/height when a Video metadata has multiple Stream ... Video: lines? #18

@raihan2006i

Description

@raihan2006i

Hi. I am using ruby-av and paperclip-av-transcoder to process user uploaded video files.
And I was trying to identify size of this video http://www.dvdloc8.com/clip.php?movieid=12167&clipid=3 with

::Av.cli.identify('/home/arman/Downloads/simpsons_movie_1080p_hddvd_trailer/The Simpsons Movie - 1080p Trailer.mp4')

and it returned size as 101x150. Note: I have ffmpeg installed

{
            :length => "0:02:17.25",
          :duration => 137.25,
               :fps => 23,
              :size => "101x150",
             :width => 101,
            :height => 150,
            :aspect => 0.6733333333333333,
      :audio_encode => "aac (LC) (mp4a / 0x6134706D)",
     :audio_bitrate => "44100 Hz",
    :audio_channels => "5.1"
}

But the actual size of video is 1920x800. Then i checked video metadata with ffmpeg

ffmpeg -i "/home/arman/Downloads/simpsons_movie_1080p_hddvd_trailer/The Simpsons Movie - 1080p Trailer.mp4" 2>&1

And it returned

ffmpeg version N-83192-gf1214ad Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1)
  configuration: --prefix=/home/arman/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/arman/ffmpeg_build/include --extra-ldflags=-L/home/arman/ffmpeg_build/lib --bindir=/home/arman/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 44.100 / 55. 44.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 63.100 / 57. 63.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 69.100 /  6. 69.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x2e90ec0] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/arman/Downloads/simpsons_movie_1080p_hddvd_trailer/The Simpsons Movie - 1080p Trailer.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2007-07-17T09:18:37.000000Z
    genre           : Trailer
    artist          : Fox
    title           : The Simpsons Movie
    date            : 2007
  Duration: 00:02:17.25, start: 0.000000, bitrate: 8591 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x800, 8486 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      creation_time   : 2007-07-17T09:18:37.000000Z
      handler_name    : GPAC ISO Video Handler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, 5.1, fltp, 107 kb/s (default)
    Metadata:
      creation_time   : 2007-07-17T09:18:45.000000Z
      handler_name    : GPAC ISO Audio Handler
    Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 101x150 [SAR 72:72 DAR 101:150], 90k tbr, 90k tbn, 90k tbc

So there are two lines which have video size information.

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x800, 8486 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 101x150 [SAR 72:72 DAR 101:150], 90k tbr, 90k tbn, 90k tbc

Now my question is in that case how I will know the actual video size? Should i consider only the first one? Because ::Av.cli.identify is considering the last one as it loops through each lines and first size information gets overwrite by last line

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions