JuliaIO / VideoIO.jl

Reading and writing of video files in Julia via ffmpeg
https://juliaio.github.io/VideoIO.jl/stable
Other
126 stars 53 forks source link

Why `API: get_start_time` CANNOT return the 'creation_time' of `FFMPEG` ? #297

Open touchft opened 3 years ago

touchft commented 3 years ago

I made a test with the following code. The test is record a usb camera to a file with specified creation time.

ffmpeg -f v4l2 -input_format mjpeg -i /dev/video3 -c:v libx264 -vf format=yuv420p -metadata "creation_time=2021-01-01 00:00:00" output.mkv

The above command output:

....
Output #0, matroska, to 'output.mkv':
  Metadata:
    creation_time   : 2020-01-01 00:00:00
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1280x720, q=-1--1, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
....

Note: the above "creation_time : 2020-01-01 00:00:00" is the local time (CST) which is 8 hrs ahead of UTC time.

Then I double check the meta data with exiftool which can be obtained by

sudo apt install libimage-exiftool-perl
$exiftool output.mkv
ExifTool Version Number         : 11.88
File Name                       : output.mkv
Directory                       : .
File Size                       : 12 MB
File Modification Date/Time     : 2021:02:06 10:11:53+08:00
File Access Date/Time           : 2021:02:05 19:49:54+08:00
File Inode Change Date/Time     : 2021:02:06 10:11:53+08:00
File Permissions                : rw-rw-r--
File Type                       : MKV
File Type Extension             : mkv
MIME Type                       : video/x-matroska
EBML Version                    : 1
EBML Read Version               : 1
Doc Type                        : matroska
Doc Type Version                : 4
Doc Type Read Version           : 2
Timecode Scale                  : 1 ms
Muxing App                      : Lavf58.29.100
Writing App                     : Lavf58.29.100
Date/Time Original              : 2019:12:31 16:00:00Z
Duration                        : 0:00:41
Track Number                    : 1
Track Language                  : und
Codec ID                        : V_MPEG4/ISO/AVC
Track Type                      : Video
Video Frame Rate                : 30
Image Width                     : 1280
Image Height                    : 720
Display Unit                    : Unknown (4)
Tag Name                        : DURATION
Tag String                      : 00:00:41.433000000
Image Size                      : 1280x720
Megapixels                      : 0.922

The above "Date/Time Original: 2019:12:31 16:00:00Z" is for UTC time, which is equal to "creation_time : 2020-01-01 00:00:00" in CST time.

Unfortunately, VideoIO.get_start_time returns "1970-01-01T00:00:00".

so, Why API: get_start_time CANNOT return the 'creation_time' of FFMPEG ?