Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
108.95k stars 10.48k forks source link

Reduce -r command recording size? #2502

Open ghost opened 3 years ago

ghost commented 3 years ago

Is there anyway to reduce the size of the recordings produced by the -r command? I'm currently looking at over 4GB per hour of recording, I'd like to knock that down to 4-500 MB if possible.

rom1v commented 3 years ago

The encoding size is determined by the --bitrate parameter (8Mbps by default). But I suggest to keep a high value, because real-time (hardware) encoders must encode quickly at the cost of efficiency.

You could then re-encode the resulting file with ffmpeg:

# higher values of crf gives smaller size, lower values of crf gives better quality
ffmpeg -i file.mp4 -c:v libx264 -crf 25 out.mp4
# you can also resize if necessary
ffmpeg -i file.mp4 -c:v libx264 -crf 25 -s 800x450 out.mp4
ghost commented 3 years ago

I'd prefer to not have to re-encode, so ill try lowering the bit rate. If that doesnt work out I will attempt re-encoding but that will end up being very time consuming.

rom1v commented 3 years ago

A low bitrate for real-time encoding gives poor quality. If you reencode, you could reduce the file size by a factor of 10 (depending on the efficiency of your device encoder) without obvious quality drop.

ghost commented 3 years ago

Yeah for sure, the issue is I'm gonna have dozens, if not hundreds of files in the long term. I also don't have a dedicated machine to do the re-encoding.