C.W.K.
Stream
Lesson 07 of 07 · published

Rotation & Album Art

~8 min · rotation, transpose, album-art, cover

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

Rotation — fixing portrait videos that play sideways

Phones write a rotation flag in the metadata; some players honor it, some don't. Two ways to fix:

  • Strip the flag and re-encode rotated: -vf transpose=1 (90° clockwise).
  • Just update the flag: -metadata:s:v rotate=0 + remux. No re-encode.

Album art on audio files

MP3 / M4A can carry a cover image. Useful for podcast episodes, music files. Add via -i cover.png -map 0 -map 1 -disposition:v:0 attached_pic.

Code

Rotation fixes·bash
# Rotate 90° clockwise (re-encode)
ffmpeg -i sideways.mp4 -vf "transpose=1" \
  -c:v libx264 -crf 20 -preset slow -c:a copy upright.mp4

# Rotate 90° counter-clockwise
ffmpeg -i sideways.mp4 -vf "transpose=2" \
  -c:v libx264 -crf 20 -preset slow -c:a copy upright.mp4

# Rotate 180°
ffmpeg -i upside.mp4 -vf "transpose=2,transpose=2" \
  -c:v libx264 -crf 20 -preset slow -c:a copy upright.mp4

# Just update the rotation tag, no re-encode
ffmpeg -i sideways.mp4 -metadata:s:v rotate=0 -c copy fixed.mp4
Attach album art·bash
# Cover art on MP3
ffmpeg -i podcast.wav -i cover.png \
  -map 0:a -map 1:v \
  -c:a libmp3lame -q:a 2 \
  -c:v copy \
  -id3v2_version 3 \
  -metadata:s:v title="Episode Cover" \
  -metadata:s:v comment="Cover (front)" \
  episode.mp3

# Same on M4A (AAC)
ffmpeg -i podcast.wav -i cover.png \
  -map 0:a -map 1:v \
  -c:a aac -b:a 192k \
  -c:v copy \
  -disposition:v:0 attached_pic \
  episode.m4a

External links

Exercise

Take a portrait phone video that plays sideways. Fix it two ways: (a) re-encode with transpose=1, (b) just update the rotation tag with -metadata:s:v rotate=0 -c copy. Open both in VLC and Apple Photos — do both methods work in both players? Then attach album art to a podcast WAV and verify the cover shows in iTunes/Music.app.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.