Often I use my iPhone to record video which is recorded in HEVC high compression format. However it doesn’t import perfectly in Screenpal that I use for video editing. To convert them to acceptable h.264 format I use the ffmpeg.exe and output in desired file format like mp4, I use the command like below
ffmpeg command
ffmpeg -i <path-to-input-file.flv> -vcodec libx264 -acodec aac <path-to-output-file.mp4>
On the bin folder directory where ffmpeg.exe resides, you can execute this command
- <path-to-input-file.flv> Path to the input file with extension
- <path-to-output-file.mp4> Path to the outputfile with extension
Exact command Worked
From this link I found below command with exact details of yuv formatting required in order to get the output working with Screenpal.
ffmpeg -i input.mp4 -c:v libx264 -pix_fmt yuv420p -c:a copy output.mp4
- -c:v libx264 tells FFmpeg to use H.264 video compression.
- -pix_fmt yuv420p tells 4:2:0 subsampling to be used, a widely used and supported pixel format.
- -c:a copy, no re-encoding is done on the audio track. It’s simply copied to the output file.
Rotating video using flags
You can add extra flags to rate the vide if required as below
ffmpeg -i <path-to-input-file.flv> -vcodec libx264 -vf "transpose=1" -acodec aac <path-to-output-file.mp4>
- transpose=1 rotates 90° Clockwise
- transpose=2 rotates 90° Counter-Clockwise
- transpose=1,transpose=1 rotates 180° Counter-Clockwise
ffmpeg Cheatsheet
A good cheat sheet can help you to paly around various ffmpeg features.
Ajay is a professional developer and architect of NI-LabVIEW applications with extreme interest in getting the hardware connected to LabVIEW and automating the stuff. Recently he is also putting his hands in NI-TestStand to get very dirty on it. He is also a good mentor for the various interns in his career. He is ready to help the people in techie roles.