User Tools

Site Tools


ffprobe:video:rotate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ffprobe:video:rotate [2025/01/13 10:04] peterffprobe:video:rotate [2025/01/13 10:20] (current) peter
Line 9: Line 9:
 ffprobe -v error -select_streams v:0 -show_entries stream_tags=rotate -of csv=s=x:p=0 input.mp4 ffprobe -v error -select_streams v:0 -show_entries stream_tags=rotate -of csv=s=x:p=0 input.mp4
 </code> </code>
 +
 +<WRAP info>
 +**NOTE:**  On unrotated videos, the above command produces no output.
 +</WRAP>
  
 ---- ----
 +
 +==== Getting Width, Height, Rotation ====
  
 <code bash> <code bash>
-rotate=$(ffprobe -v error -select_streams v:0 -show_entries stream_tags=rotate -of csv=s=x:p=0 "${sourceFile}"+ffprobe -v error -select_streams v:0 -show_entries stream=width,height:stream_tags=rotate -of csv=p=0 input.mp4
-if [ "$rotate" != "" ]; then  +
-    echo "We need to rotate: $rotate" +
-fi+
 </code> </code>
 +
 +returns:
 +
 +<code bash>
 +1920,1080,270
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  Even though the rotation here is 270, the width and height are still shown as if the orientation was portrait.
 +
 +  * Due to the 270 rotation, in reality the actual input should be 1080x1920, and not 1920x1080.
 +    * But ffprobe reports the actual width x height; Width is displayed first, then height (no matter the order it is requested).
 +
 +</WRAP>
 +
  
 ---- ----
  
-===== With Grep =====+===== Using Grep =====
  
 <code bash> <code bash>
Line 32: Line 50:
 rotate          : 90 rotate          : 90
 </code> </code>
 +
 +----
 +
 +===== In a Bash Script =====
 +
 +<code bash>
 +rotate=$(ffprobe -v error -select_streams v:0 -show_entries stream_tags=rotate -of csv=s=x:p=0 "${sourceFile}")
 +if [ "$rotate" != "" ]; then 
 +    echo "We need to rotate: $rotate"
 +fi
 +</code>
 +
 +----
  
ffprobe/video/rotate.1736762687.txt.gz · Last modified: 2025/01/13 10:04 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki