ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: dengelsma on October 09, 2019, 01:28:25 PM

Title: Incorrect Video Resolution Reported for .DV Files
Post by: dengelsma on October 09, 2019, 01:28:25 PM
I'm trying to get the video resolution of a .dv file originally from a Sony Digital8 camcorder. The correct resolution is 720x480 (NTSC) and the MediaInfo tool, as well as ffprobe report 720x480 to be the resolution. However, exiftool is reporting the PAL resolution of 720x576 as seen below (using the command: exiftool -a -G1 -s ./2711_43e2b68a6514662.dv):

[ExifTool]      ExifToolVersion                 : 11.69
[System]        FileName                        : 2711_43e2b68a6514662.dv
[System]        Directory                       : .

[System]        FileSize                        : 18 MB
[System]        FileModifyDate                  : 2012:11:13 12:20:29-05:00
[System]        FileAccessDate                  : 2019:10:09 13:09:09-04:00
[System]        FileInodeChangeDate             : 2019:10:09 06:00:13-04:00
[System]        FilePermissions                 : rwxrwxr-x
[File]          FileType                        : DV
[File]          FileTypeExtension               : dv
[File]          MIMEType                        : video/x-dv
[DV]            DateTimeOriginal                : 2001:06:23 12:34:33
[DV]            ImageWidth                      : 720
[DV]            ImageHeight                     : 576
[DV]            Duration                        : 5.13 s
[DV]            TotalBitrate                    : 28.8 Mbps
[DV]            VideoFormat                     : IEC 61834 - 625/50 (PAL)
[DV]            VideoScanType                   : Progressive
[DV]            FrameRate                       : 25
[DV]            AspectRatio                     : 5:4
[DV]            Colorimetry                     : 4:2:0
[DV]            AudioChannels                   : 4
[DV]            AudioSampleRate                 : 32000
[DV]            AudioBitsPerSample              : 12
[Composite]     ImageSize                       : 720x576
[Composite]     Megapixels                      : 0.415




I'm running the following version of exiftool on Ubuntu Linux 19.04 x64:

ExifTool version 11.69
Perl version 5.028001 (-C0)
Platform: linux
Optional libraries:
  Archive::Zip                 1.64
  Compress::Zlib               2.074
  Digest::MD5                  2.55
  Digest::SHA                  6.01
  IO::Compress::Bzip2          2.074
  Time::Piece                  1.3204
  Unicode::LineBreak           (not installed)
  IO::Compress::RawDeflate     2.074
  IO::Uncompress::RawInflate   2.074
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: Phil Harvey on October 09, 2019, 01:37:37 PM
Can you send me a sample (philharvey66 at gmail.com)?

- Phil
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: Phil Harvey on October 10, 2019, 07:56:39 AM
I got the sample, thanks.

I have found the problem, and this will be fixed in ExifTool 11.71.

Thanks for this report.

- Phil
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: dengelsma on October 10, 2019, 08:00:57 AM
Thanks for the update! I also saw that exiftool was reporting the video as 'Progressive', when, in fact, the video is 'Interlaced'.
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: Phil Harvey on October 10, 2019, 08:38:29 AM
Thanks again.  I've looked into this and the ffmpeg code that I was using as a reference has changed significantly in the last 9 years and no longer determines interlaced/progressive from the header.  It seems this may be determined reliably only by looking at the individual video frames, which I don't want to do.  So I think I'll just remove the VideoScanType tag from ExifTool to avoid having to deal with this.

I have a test version now which gives this for the video you sent:

> exiftool tmp/NTSC_720x480.dv -dv:all
Date/Time Original              : 2001:06:23 12:36:42
Image Width                     : 720
Image Height                    : 480
Duration                        : 23.96 s
Total Bitrate                   : 28.8 Mbps
Video Format                    : IEC 61834, SMPTE-314M - 525/60 (NTSC)
Frame Rate                      : 29.97
Aspect Ratio                    : 5:4
Colorimetry                     : 4:1:1
Audio Channels                  : 4
Audio Sample Rate               : 32000
Audio Bits Per Sample           : 12


- Phil
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: dengelsma on October 10, 2019, 09:17:46 AM
That's fair. The output looks good!
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: dengelsma on October 10, 2019, 09:26:27 AM
Quote from: Phil Harvey on October 10, 2019, 08:38:29 AM
Thanks again.  I've looked into this and the ffmpeg code that I was using as a reference has changed significantly in the last 9 years and no longer determines interlaced/progressive from the header.  It seems this may be determined reliably only by looking at the individual video frames, which I don't want to do.  So I think I'll just remove the VideoScanType tag from ExifTool to avoid having to deal with this.

I have a test version now which gives this for the video you sent:

> exiftool tmp/NTSC_720x480.dv -dv:all
Date/Time Original              : 2001:06:23 12:36:42
Image Width                     : 720
Image Height                    : 480
Duration                        : 23.96 s
Total Bitrate                   : 28.8 Mbps
Video Format                    : IEC 61834, SMPTE-314M - 525/60 (NTSC)
Frame Rate                      : 29.97
Aspect Ratio                    : 5:4
Colorimetry                     : 4:1:1
Audio Channels                  : 4
Audio Sample Rate               : 32000
Audio Bits Per Sample           : 12


- Phil


After another look... should the aspect ratio be 4:3 for 720x480?
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: Phil Harvey on October 10, 2019, 09:54:55 AM
Hmmm.  Again, the aspect ratio determination has changed in the ffmpeg code, and I can't see this in the current version.  However, I think this may be the difference between SAR (Storage Aspect Ratio) and DAR (Display Aspect Ratio).  It probably does make sense for ExifTool to report DAR.  I will look into changing this.

Also, I may have figured out how to determine interlaced or progressive -- I'm still thinking about this.

- Phil

Edit:  On second thought, I have no idea what 5/4 would indicate.  4/3 makes much more sense, and I'll change ExifTool to report this.  Also, I think I have figured out the interlace/progressive decoding, but I can't find a good range of samples to test this with.
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: dengelsma on October 10, 2019, 03:18:33 PM
Do you want some video samples of both types (progressive/interlaced) to test? I can provide them, if you wish.

(I'm gathering some now, and will send you the links if you want to use them for testing.)
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: Phil Harvey on October 10, 2019, 10:01:52 PM
That would be great, thanks.

- Phil
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: Phil Harvey on October 11, 2019, 07:59:48 AM
Also, I'm wondering about the audio parameters.  The QuickTime player shows 32kHz stereo 16-bit, while ExifTool reports 32kHz 4-channel 12-bit.

- Phil

Edit: I put some debugging code in ffmpeg, and it does indeed decode the audio as 12-bit. And it sets the number of channels to 2, but in the code it says "note: ach counts PAIRS of channels (i.e. stereo channels)", so my interpretation of this is that there are 4 channels.  ffprobe returns this:

  Metadata:
    timecode        : 00:20:48;28
  Duration: 00:00:00.30, start: 0.000000, bitrate: 27279 kb/s
    Stream #0:0: Video: dvvideo, yuv411p, 720x480 [SAR 8:9 DAR 4:3], 25000 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s
    Stream #0:2: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s


Which indicates 2 stereo channels.  ie. 4 channels total.  Although it says "s16", which seems to indicate 16-bit, the ffmpeg code definitely converts from 12 bits.
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: dengelsma on October 11, 2019, 09:18:39 AM
The 720x480 clips came from a Sony TRV-120 video camera. The audio specs in the manual are:

Audio recording system
PCM System Quantization:

- 12 bits (Fs 32 kHz, stereo 1, stereo 2)
- 16 bits (Fs 48 kHz, stereo)

If I recall correctly, I believe my camera settings were set for 16 bit audio at 48 kHz.

I checked the 720x480 sample files I sent you and they show 2 channels/16 bit PCM data... (I used ffprobe and MediaInfo to find this information.)
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: dengelsma on October 11, 2019, 09:27:37 AM
The .MTS file sent to you has 6 channels (5.1 audio) in an AC-3 (codec) stream at 384 kbps.

(I'm using ffprobe to extract this data.)
Title: Re: Incorrect Video Resolution Reported for .DV Files
Post by: Phil Harvey on October 11, 2019, 09:32:09 AM
I just found the email you sent (it got flagged as junk, which is a problem because I get hundreds of junk mails per day.  For future reference, put "ExifTool" anywhere in the mail and it won't get flagged as junk).

Unfortunately, none of the videos you sent were DV format, so the decoding of these is very different.  Three were MOV format, and one was M2TS.

- Phil