Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to find out the camera device ID in the metadata of images and videos?
Forum Updated to NodeBB v4.3 + New Features

How to find out the camera device ID in the metadata of images and videos?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DeSa
    wrote on last edited by
    #1

    Hi,

    I am working on a small SW project where I develop a tailired SW for my needs to manipilate, tag, classify and manipulate (copies of) media data (most image formats and video formats). I use Qt6 and the file types are jpg, mp4, png, mts, avi, mpg, ...

    All media is our 50k+ images and videos we took during the last 7 years. Cameras used to capture those media files are numerous (android phone camera, standalone digital cameras, gopro cameras,...).

    Some cameras were not set up properly such that the time and date was set to default or geolocation was not available as gps was disabled.

    In addition, strange phenomenon observed when gopro images/videos were copied to hard drives (and backups) such that

    QFileInfo f("myfile.jpg");
    QDateTime  dt = f. metadataChangeTime();
    

    results in a older date than

    QFileInfo f("myfile.jpg");
    QDateTime  dt = f. birthTime();
    

    which doesn't make sense. birth time was giving me the exact date when that file was copied to the hard drive rather than the date and time when it was taken using the camera device (unfortunatelly, I freed all memory on gopro every now and then and original files whch probably have that info unaltered are gone).
    Question 1: Do you know if birth time can be retrieved somehow (maybe in some other meta data attribute using any of the classes available in Qt6 instead of QFileInfo)? I cant believe that a simple copy task on windows can alter birth time and set it to the date and time of the copying of this file.

    Working with

    QMediaPlayer
    

    also has some disadvantages as to retrieve meta data reliably by connecting to

    mediaStatusChanged()
    

    signal, and wait for the status

    QMediaPlayer::LoadedMedia
    

    to have the proper status and when working with files stored on hard drives

    QMediaPlayer::LoadedMedia
    

    is not true for worst case 1 sec. As I use multithreading to do most of the loading of (50k+ media) meta data, waiting for mediaStatusChanged() and QMediaPlayer::LoadedMedia to have the proper status is pain in the.... and on top of that the information provided is limited

    QMediaMetaData::AudioBitRate "189141"
    QMediaMetaData::Resolution "1920 x 1440"
    QMediaMetaData::VideoBitRate "60115140"
    QMediaMetaData::AudioCodec "AAC"
    QMediaMetaData::Orientation "0"
    QMediaMetaData::Date "2021-07-02T17:42:47.000Z"
    QMediaMetaData::VideoFrameRate "59.94005994005994"
    QMediaMetaData::FileFormat "MPEG-4"
    QMediaMetaData::Duration "00:00:30"
    QMediaMetaData::VideoCodec "H264"
    

    Question 2: Is there a way to retrieve an unique Camera device ID (serial number or anything similar) from meta data for images and videos to be able to exclude camera devices where "strage behaviour" is observed in the media files (missing geoinformation, corrupted birth time, ...)?

    I tried creating an unique identifier by taking into account image resolution AND bit rate AND frame rate AND video codec (in case of video files) and some more info available in

    QMediaMetaData
    

    but this did not work as we had up to 3 cameras with same model and make where 2 of the 3 were configured poorly (no geoloacation, wrong date and time setup,...)

    C 1 Reply Last reply
    0
    • D DeSa

      Hi,

      I am working on a small SW project where I develop a tailired SW for my needs to manipilate, tag, classify and manipulate (copies of) media data (most image formats and video formats). I use Qt6 and the file types are jpg, mp4, png, mts, avi, mpg, ...

      All media is our 50k+ images and videos we took during the last 7 years. Cameras used to capture those media files are numerous (android phone camera, standalone digital cameras, gopro cameras,...).

      Some cameras were not set up properly such that the time and date was set to default or geolocation was not available as gps was disabled.

      In addition, strange phenomenon observed when gopro images/videos were copied to hard drives (and backups) such that

      QFileInfo f("myfile.jpg");
      QDateTime  dt = f. metadataChangeTime();
      

      results in a older date than

      QFileInfo f("myfile.jpg");
      QDateTime  dt = f. birthTime();
      

      which doesn't make sense. birth time was giving me the exact date when that file was copied to the hard drive rather than the date and time when it was taken using the camera device (unfortunatelly, I freed all memory on gopro every now and then and original files whch probably have that info unaltered are gone).
      Question 1: Do you know if birth time can be retrieved somehow (maybe in some other meta data attribute using any of the classes available in Qt6 instead of QFileInfo)? I cant believe that a simple copy task on windows can alter birth time and set it to the date and time of the copying of this file.

      Working with

      QMediaPlayer
      

      also has some disadvantages as to retrieve meta data reliably by connecting to

      mediaStatusChanged()
      

      signal, and wait for the status

      QMediaPlayer::LoadedMedia
      

      to have the proper status and when working with files stored on hard drives

      QMediaPlayer::LoadedMedia
      

      is not true for worst case 1 sec. As I use multithreading to do most of the loading of (50k+ media) meta data, waiting for mediaStatusChanged() and QMediaPlayer::LoadedMedia to have the proper status is pain in the.... and on top of that the information provided is limited

      QMediaMetaData::AudioBitRate "189141"
      QMediaMetaData::Resolution "1920 x 1440"
      QMediaMetaData::VideoBitRate "60115140"
      QMediaMetaData::AudioCodec "AAC"
      QMediaMetaData::Orientation "0"
      QMediaMetaData::Date "2021-07-02T17:42:47.000Z"
      QMediaMetaData::VideoFrameRate "59.94005994005994"
      QMediaMetaData::FileFormat "MPEG-4"
      QMediaMetaData::Duration "00:00:30"
      QMediaMetaData::VideoCodec "H264"
      

      Question 2: Is there a way to retrieve an unique Camera device ID (serial number or anything similar) from meta data for images and videos to be able to exclude camera devices where "strage behaviour" is observed in the media files (missing geoinformation, corrupted birth time, ...)?

      I tried creating an unique identifier by taking into account image resolution AND bit rate AND frame rate AND video codec (in case of video files) and some more info available in

      QMediaMetaData
      

      but this did not work as we had up to 3 cameras with same model and make where 2 of the 3 were configured poorly (no geoloacation, wrong date and time setup,...)

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @DeSa said in How to find out the camera device ID in the metadata of images and videos?:

      Question 1: Do you know if birth time can be retrieved somehow (maybe in some other meta data attribute using any of the classes available in Qt6 instead of QFileInfo)? I cant believe that a simple copy task on windows can alter birth time and set it to the date and time of the copying of this file.

      Why can't you believe this? The evidence is right in front of you. The birth time of the file on the Windows file system is whenever you created the file. It has zero to do with the content of the file, or the creation time of the file on any previous system.

      The only way to get a date/time that the photograph/video was actually taken is if the camera places a reliable timestamp in the metadata of the image/video (usually Exif in photos, and container specific for video). This is not the same as the metadata referred to in the QFileInfo class, which relates to the file as an object.

      As for the metadataChangeTime() being before the birthTime(), different by how much?

      @DeSa said in How to find out the camera device ID in the metadata of images and videos?:

      Question 2: Is there a way to retrieve an unique Camera device ID (serial number or anything similar) from meta data for images and videos to be able to exclude camera devices where "strage behaviour" is observed in the media files (missing geoinformation, corrupted birth time, ...)?

      If the camera chose to place a make, model, serial number and software version in the Exif metadata then that can be used (example). Otherwise, no. My Samsung phone, for example, does not expose a serial number.

      Missing geolocation data is not "strange behaviour". That data is optional, requires an active GPS in the camera, and is often off-by-default a as privacy concern.

      You should look at exiftool to see how it might help you.

      D 1 Reply Last reply
      2
      • C ChrisW67

        @DeSa said in How to find out the camera device ID in the metadata of images and videos?:

        Question 1: Do you know if birth time can be retrieved somehow (maybe in some other meta data attribute using any of the classes available in Qt6 instead of QFileInfo)? I cant believe that a simple copy task on windows can alter birth time and set it to the date and time of the copying of this file.

        Why can't you believe this? The evidence is right in front of you. The birth time of the file on the Windows file system is whenever you created the file. It has zero to do with the content of the file, or the creation time of the file on any previous system.

        The only way to get a date/time that the photograph/video was actually taken is if the camera places a reliable timestamp in the metadata of the image/video (usually Exif in photos, and container specific for video). This is not the same as the metadata referred to in the QFileInfo class, which relates to the file as an object.

        As for the metadataChangeTime() being before the birthTime(), different by how much?

        @DeSa said in How to find out the camera device ID in the metadata of images and videos?:

        Question 2: Is there a way to retrieve an unique Camera device ID (serial number or anything similar) from meta data for images and videos to be able to exclude camera devices where "strage behaviour" is observed in the media files (missing geoinformation, corrupted birth time, ...)?

        If the camera chose to place a make, model, serial number and software version in the Exif metadata then that can be used (example). Otherwise, no. My Samsung phone, for example, does not expose a serial number.

        Missing geolocation data is not "strange behaviour". That data is optional, requires an active GPS in the camera, and is often off-by-default a as privacy concern.

        You should look at exiftool to see how it might help you.

        D Offline
        D Offline
        DeSa
        wrote on last edited by
        #3

        @ChrisW67

        @ChrisW67 said in How to find out the camera device ID in the metadata of images and videos?:

        Why can't you believe this? The evidence is right in front of you. The birth time of the file on the Windows file system is whenever you created the file. It has zero to do with the content of the file, or the creation time of the file on any previous system.

        Its because for all other 45k media files (except for those taken with that one particular gopro camera)

        QFileInfo f("myfile.jpg");
        QDateTime  dt = f. metadataChangeTime();
        

        and

        QFileInfo f("myfile.jpg");
        QDateTime  dt = f. birthTime();
        

        return identical values and they reflect exactly the time when this media was created. So QFileInfo must somehow have accessed this otherwize the date would be different.

        @ChrisW67 said in How to find out the camera device ID in the metadata of images and videos?:

        As for the metadataChangeTime() being before the birthTime(), different by how much?

        1 year apart. exactly the time distance btw media recorded and media copied to hard drive.

        @ChrisW67 said in How to find out the camera device ID in the metadata of images and videos?:

        You should look at exiftool to see how it might help you.

        I did integrate the exiftool package into my codde. That is why for jpg only, this is not a problem. But for any other file format, be it video or image, problem is unsolved.

        But, you just inspired me to invest more time for a solution: maybe if I dedicate more time understanding what exif tool code does in particular and as it simply reads meta data for jpg, maybe I can modify it to read any media file's meta data (provided that I gain full understanding of where the meta data is accessible for each file).

        I created this bug (actually a suggestion how to improve) which might solve my birth date problem and as

        QMediaMetaData
        

        also can access most if not all meta data once

        [mediaStatusChanged()](link url)

        but with delay with which miltithreading cannot live with as described above:

        [https://bugreports.qt.io/browse/QTBUG-120959](link url)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved