Incorrect Video Resolution Reported for .DV Files

Started by dengelsma, October 09, 2019, 01:28:25 PM

Previous topic - Next topic

dengelsma

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

Phil Harvey

Can you send me a sample (philharvey66 at gmail.com)?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

I got the sample, thanks.

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

Thanks for this report.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dengelsma

Thanks for the update! I also saw that exiftool was reporting the video as 'Progressive', when, in fact, the video is 'Interlaced'.

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dengelsma


dengelsma

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?

Phil Harvey

#7
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.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dengelsma

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.)

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

#10
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.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dengelsma

#11
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.)

dengelsma

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.)

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).