peregin / gps-overlay-on-video

Telemetry (GPS) data overlay on videos
MIT License
278 stars 36 forks source link

Video orientation info is not used #228

Closed panjacek closed 3 weeks ago

panjacek commented 3 weeks ago

I use DJI action 3 mounted on chest strap for bike and to get best angle I mount it upside down.

VLC or other modern software can read the orientation metadata and show them properly, however when I try here its upside down so the metadata is ignored.

image

kvr000 commented 3 weeks ago

@panjacek : can you please share the video (or small sample) ? Is it upside down only in the app and rendering is correct or is it wrong in both?

panjacek commented 3 weeks ago

These are huge files.. limit here is only 10 MBs. its inverted display and rendered as well.

exiftool on short one is showing this:

Directory                       : .
File Size                       : 18 MB
File Modification Date/Time     : 2024:08:25 17:58:01+02:00
File Access Date/Time           : 2024:08:25 17:59:08+02:00
File Inode Change Date/Time     : 2024:08:25 17:58:01+02:00
File Permissions                : -rwxrwxrwx
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 Base Media v1 [IS0 14496-12:2003]
Minor Version                   : 0.2.0
Compatible Brands               : isom, iso2, avc1, mp41
Media Data Size                 : 16521706
Media Data Offset               : 512
Movie Header Version            : 0
Create Date                     : 2024:08:25 15:55:58
Modify Date                     : 2024:08:25 15:55:58
Time Scale                      : 24000
Duration                        : 3.97 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 7
Track Header Version            : 0
Track Create Date               : 2024:08:25 15:55:58
Track Modify Date               : 2024:08:25 15:55:58
Track ID                        : 1
Track Duration                  : 3.96 s
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 1920
Image Height                    : 1080
Time Code                       : 6
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 1920
Source Image Height             : 1080
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Color Profiles                  : nclx
Color Primaries                 : BT.709
Transfer Characteristics        : BT.709
Matrix Coefficients             : BT.709
Video Frame Rate                : 23.976
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 48000
Warning                         : [minor] The ExtractEmbedded option may find more tags in the media data
Meta Format                     : dbgi
Matrix Structure                : -1 0 0 0 -1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2024:08:25 15:55:58
Media Modify Date               : 2024:08:25 15:55:58
Media Time Scale                : 24000
Media Duration                  : 3.96 s
Media Language Code             : und
Handler Description             : TimeCodeHandler
Gen Media Version               : 0
Gen Flags                       : 0 0 0
Gen Graphics Mode               : ditherCopy
Gen Op Color                    : 32768 32768 32768
Gen Balance                     : 0
Text Font                       : System
Text Face                       : Plain
Text Size                       : 12
Text Color                      : 0 0 0
Background Color                : 65535 65535 65535
Font Name                       : Lucida Grande
Other Format                    : tmcd
Playback Frame Rate             : 23.97602398
Handler Vendor ID               : Apple
Encoder                         : DJI OsmoAction3
Cover Art                       : (Binary data 601614 bytes, use -b option to extract)
Handler Type                    : Metadata Tags
Image Size                      : 1920x1080
Megapixels                      : 2.1
Avg Bitrate                     : 33.3 Mbps
Rotation                        : 180

I think the Rotation bit is the one used by apps to decide to flip videos automatically.

kvr000 commented 3 weeks ago

Thanks @panjacek , the video sample would be good to confirm and verify eventual fix. You can cut few seconds of the video, for example using ffmpeg: ffmpeg -ss 00:00:00 -to 00:02:00 -i input.mp4 -c copy output.mp4