Nathaniel Bubis
Nathaniel Bubis

Reputation: 2295

ffmpeg apply filters without rencoding?

I want to rotate a video using ffmpeg, but I don't want to lose quality by re-encoding.

If I try

ffmpeg -i in.mp4 -vf 'vflip,hflip' -ss 120 -t 200 -c:v copy -c:a copy out.mp4

No rotation gets preformed. If I instead specify the encoding by using, say -c:v h264, I'm afraid I'll lose some quality. Is there a "losssless" (relative to the original encoding) way of applying a filter?

Upvotes: 2

Views: 2435

Answers (1)

llogan
llogan

Reputation: 133823

Use a lossless encoder

Use of filters requires re-encoding. You can use a lossless encoder if quality is the most important factor:

ffmpeg -i in.mp4 -vf 'vflip,hflip' -ss 120 -t 200 -c:v libx264 -preset veryslow \
-crf 0 -c:a copy out.mp4

Using -crf 0 when using libx264 will create a lossless output but the file size may be very large.

Rotate upon playback

Rotating during playback will of course preserve the quality:

ffplay input.mp4 -vf hflip,vflip

Also see

Upvotes: 2

Related Questions