Extract rotation data with ffprobe 5 and newer
Asked Answered
M

1

6

ffprobe releases after 4.4 don't allow to read the video orientation via -select_streams v:0 -show_entries stream_tags=rotate. Apparently this is by design and the alternative is to read the display matrix side data, according to this ticket: https://trac.ffmpeg.org/ticket/9452

This works on Mac:

ffprobe -loglevel error -select_streams v:0 -show_entries side_data=rotation -of default=nw=1:nk=1 input.mp4

But on ffprobe for Windows, old and new versions, the program hangs forever. Is there a viable alternative? Or should we stick to ffprobe 4.4 if we need rotation data? Or is there a way to read this in ffmpeg?

Thank you

Mesonephros answered 30/1, 2022 at 23:53 Comment(4)
Use 4.4 for now. It should be patched in a couple of days in git builds.Splutter
@Gyan, sorry, what should be patched in a couple of days? Is stream_tags=rotate coming back? Or will side_data=rotation be fixed? ThanksMesonephros
The latter......Splutter
I noticed with the latest ffprobe binaries the result is printed correctly, but it's way slower than using -show_entries stream_tags=rotate with 4.4. Is this expected?Mesonephros
S
12

With git build newer than Feb 3rd 2022, you can use

ffprobe -v 0 -select_streams v:0 -show_entries stream_side_data=rotation -of default=nw=1:nk=1 input.mp4

Splutter answered 10/2, 2022 at 11:30 Comment(2)
That works and it's fast. Thank youMesonephros
For anyone wondering, it appears we’ll have to wait for the release after 5.0.1. Via ffmpeg.org/download.html#release_5.0 “FFmpeg 5.0.1 ‘Lorentz’ was released on 2022-04-04. It is the latest stable FFmpeg release from the 5.0 release branch, which was cut from master on 2022-01-04.”Septillion

© 2022 - 2024 — McMap. All rights reserved.