rupeshforu3
Disciple
Hi I am Rupesh from India and I have some mp4 video files which are downloaded from YouTube and captured from android smartphone camera. I have compressed these files using ffmpeg script and I am providing to you which may help you to do the same.
Generally these files are of large size specifically captured from android smartphone camera. So I tried a lot to compress these files using ffmpeg command and some guis like handbrake, X media recode etc.,. But all of these have their own pros and cons. I have developed a small shell script to compress these mp4 videos using ffmpeg command and x265 video codec, fdkaac. This script can be modified according to your needs and run.
Simply place the script in the folder which you have mp4 videos you want to compress and after that give execution permission and after that execute it in terminal emulator.
The system requirements are working Linux PC, ffmpeg built with libfdk\_aac and libx265 and gpl, opencl, opengl support.
Many of you may think as there are many ffmpeg guis and scripts available why I must use the current one. But all of the guis can't run according to your needs for example I have used one ffmpeg gui where it tries to encode 3 to 4 videos at a time but if there is any power failure again you must start the process from the beginning. There are a number of scripts available for ffmpeg but they may be difficult to understand to you. The script I am providing is easy to understand and use. It uses all the system resources to compress videos one by one with optimal quality.
I have read a lot of documents and tutorials related to x265 including
[https://x265.readthedocs.io/en/2.5/cli.html](https://x265.readthedocs.io/en/2.5/cli.html)
[https://slhck.info/video/2017/03/01...lhck.info/video/2017/03/01/rate-control.html)
[https://ffmpeg.org/ffmpeg.html](https://ffmpeg.org/ffmpeg.html)
In these scripts I have used ffmpeg tool which is used in many projects and even in YouTube. After that I have used x265 which is the latest video standard developed which uses less memory for quality videos. After that I have used fdkaac which is the best audio codec developed which uses less memory for quality audio.
I am providing three scripts one which uses 2 pass encoding and another which uses CRF encoding and another which doesn't use any of the above two.
In the above scripts the first one uses two pass encoding to compress video file with maximum quality but takes lot of time and produces lowest possible memory size. The second script that used CRF takes lot of memory space with maximum quality and takes less time. The third script takes less time and less memory space but the quality is unknown.
I am finally suggesting you to modify the cpucount option to your processor core count -1. If you don't do this cpu usage may be upto 99 percent which will generate much heat and destroy the PC.
I have created these scripts according to my needs like I have not included option for intel quick sync as I don't have such new processor.So if you want create your own version with modifications and run and distribute to others.
I am providing the scripts, ffmpeg builds which are compiled by me from latest git repository.
I am providing these scripts to help you in any way if you are working with compression of video files. I hope that it may help you in any way.
Any critics are always welcome.
I have created a project in source forge and I am providing the link below
Regards,
Rupesh.
Generally these files are of large size specifically captured from android smartphone camera. So I tried a lot to compress these files using ffmpeg command and some guis like handbrake, X media recode etc.,. But all of these have their own pros and cons. I have developed a small shell script to compress these mp4 videos using ffmpeg command and x265 video codec, fdkaac. This script can be modified according to your needs and run.
Simply place the script in the folder which you have mp4 videos you want to compress and after that give execution permission and after that execute it in terminal emulator.
The system requirements are working Linux PC, ffmpeg built with libfdk\_aac and libx265 and gpl, opencl, opengl support.
Many of you may think as there are many ffmpeg guis and scripts available why I must use the current one. But all of the guis can't run according to your needs for example I have used one ffmpeg gui where it tries to encode 3 to 4 videos at a time but if there is any power failure again you must start the process from the beginning. There are a number of scripts available for ffmpeg but they may be difficult to understand to you. The script I am providing is easy to understand and use. It uses all the system resources to compress videos one by one with optimal quality.
I have read a lot of documents and tutorials related to x265 including
[https://x265.readthedocs.io/en/2.5/cli.html](https://x265.readthedocs.io/en/2.5/cli.html)
[https://slhck.info/video/2017/03/01...lhck.info/video/2017/03/01/rate-control.html)
[https://ffmpeg.org/ffmpeg.html](https://ffmpeg.org/ffmpeg.html)
In these scripts I have used ffmpeg tool which is used in many projects and even in YouTube. After that I have used x265 which is the latest video standard developed which uses less memory for quality videos. After that I have used fdkaac which is the best audio codec developed which uses less memory for quality audio.
I am providing three scripts one which uses 2 pass encoding and another which uses CRF encoding and another which doesn't use any of the above two.
In the above scripts the first one uses two pass encoding to compress video file with maximum quality but takes lot of time and produces lowest possible memory size. The second script that used CRF takes lot of memory space with maximum quality and takes less time. The third script takes less time and less memory space but the quality is unknown.
I am finally suggesting you to modify the cpucount option to your processor core count -1. If you don't do this cpu usage may be upto 99 percent which will generate much heat and destroy the PC.
I have created these scripts according to my needs like I have not included option for intel quick sync as I don't have such new processor.So if you want create your own version with modifications and run and distribute to others.
I am providing the scripts, ffmpeg builds which are compiled by me from latest git repository.
I am providing these scripts to help you in any way if you are working with compression of video files. I hope that it may help you in any way.
Any critics are always welcome.
I have created a project in source forge and I am providing the link below
Regards,
Rupesh.