Exemple: vidéo de 1920x1080 en 480x270
ffmpeg -i in.mp4 -filter:v "crop=480:270:200:200" -crf 23 out.mp4
ffmpeg -i in.mp4 -filter:v "crop=480:270:200:100" -c:a copy -qp 0 out.mp4
-crf 23 et -qp 0 pour loseless video cropping. Avec H.264, il y a forcément perte de qualité
Cropper durant la lecture
ffplay -vf "crop=480:270:200:100" input.mp4
vlc input.mp4 --crop=480x270+200+100
lossless format
format lossless : ffv1, huffyuv, ffvhuff, utvideo, libx264 (-crf 0 ou -qp 0). Attention: GROS FICHIERS.
ffmpeg -i input.mp4 -vf "crop=480:270:200:100" -c:v ffv1 -c:a copy output.mkv
ffmpeg -i input.mp4 -vf "crop=480:270:200:100" -c:v libx264 -crf 0 -c:a copy output.mp4
Accept some quality loss
ffmpeg -i input -vf "crop=480:270:200:100" -c:v libx264 -crf 17 -c:a copy ouput.mp4
If your input is MJPEG
extraire la vidéo en jpeg > cropper losslessly with jpegtran > remux avec ffmpeg.
you can only set the amount of cropping from the four edges, not the target rectangle size. For the OP's 480×270 area at position (200,200) from the top left in a 1920×1080 full HD frame, we get:
ffmpeg -i in.mp4 -codec copy -bsf:v h264_metadata=crop_left=200:crop_right=1240:crop_top=200:crop_bottom=610 out.mp4
FFmpeg's doc sections 7.4.3.2.1 et 7.4.2.1.1 du H.265 et H.264 specifications