How do I reverse a video with ffmpeg?
You can use the following command to reverse a video with ffmpeg:
```sh
ffmpeg -i my_video.mp4 -vf reverse my_video_reversed.mp4
```
Note that this command reverses only the video, not the audio. If you'd like to reverse both the video and the audio, use the following command:
```sh
ffmpeg -i my_video.mp4 -vf reverse -af areverse my_video_reversed.mp4
```
Which codec is going to be used in this scenario? Is it going to recompress the video, meaning there will be quality loss?
In the given ffmpeg command, no specific codec is specified, so ffmpeg will use the default codec for the output format (MP4 in this case). The default video codec for MP4 is usually H.264 (libx264) and the default audio codec is AAC. This means the video will indeed be recompressed, and there might be a slight loss in quality due to the additional compression.

If you want to minimize the quality loss, you can adjust the output settings, such as the video bitrate or use a higher quality preset. For example:
```
ffmpeg -i my_video.mp4 -vf reverse -af areverse -c:v libx264 -crf 18 -preset veryslow my_video_reversed.mp4
```
In this command, `-crf 18` sets the Constant Rate Factor (lower values mean better quality) and `-preset veryslow` chooses a slower encoding preset to achieve better compression efficiency.

Alternatively, if your original video uses a lossless codec, you can use the same codec for the reversed video to avoid quality loss due to recompression. However, keep in mind that lossless codecs usually produce larger output files.