-3

So, I configured my ipcams to send event videos to a FTP server that saves it locally, and run a script that convert every video into something that can be opened in a generic browser, then send it to a S3 (I am using pyftpdlib + my modifications).

But i don't think that I am doing it in the most effective way. On my computer (a fairly good laptop) it usually takes half the video playtime to convert into a mp4 using a generic ffmpeg command that i simple copy and paste from stackoverflow. I tried to look up the documentation, but i simple don't have the multimedia background to understand it.

What would be the most time effective format and how to convert a raw h.265 video to it?

IamRichter
  • 15
  • 9
  • You can speed up and slow down encoding ruins presets. But that impacts quality so you will need to test to see what quality is acceptable. Also h264 is faster to encode that h265, but again it will impact quality. – szatmary Apr 29 '20 at 14:59
  • Thanks @szatmary. I will make a few tests with h264. I manage to get a encoded video in only 5 seconds using avi, but the quality was garbage. The webm was quite small, but take many times the amount of time that mp4 took. How do I speed up the encoding? – IamRichter Apr 29 '20 at 15:47
  • *"how to convert a raw h.265 video"* If the input is raw H.265 just mux it into MP4: `ffmpeg -i input.h265 -c copy -movflags +faststart output.mp4` That will be the most efficient method. Downside is that the H.265 encoder in the camera is likely inefficient. – llogan Apr 29 '20 at 17:00
  • @llogan. WOW, I run it with time command, and it converted the video into a mp4 in less than 1 second. Well, the size was the same (7,7MB, instead of the 3,8MB using the ffmpeg -i without any other option), but it was fast. I guess this solves my problem. Thank you very much. I was afraid of lock my server if for some reason too many cameras send files at the same time, and this just simple solve my problem. – IamRichter Apr 29 '20 at 17:25

1 Answers1

0

Your inputs are already H.265/HEVC, so you can simply mux them into MP4 without needing to re-encode. This will be very fast as it is "copying and pasting" the H.265 video into the MP4 container:

ffmpeg -i input.h265 -c copy -movflags +faststart output.mp4

The camera's H.265 encoder isn't as good as x265, so if you do need to shrink the file you'll need to re-encode (but be aware of generation loss):

ffmpeg -i input.h265 -c:v libx265 -crf 28 -preset medium -movflags +faststart output.mp4
  • Adjust -crf and -preset to your liking. See FFmpeg Wiki: H.265 for more info about those options.

  • If libx265 is too slow use libx264 which is faster but file size will be bigger. See FFmpeg Wiki: H.264 for more info.

llogan
  • 121,796
  • 28
  • 232
  • 243
  • Great explanation. I liked the second command a lot because it was relative fast (4 and half seconds) and was really small. – IamRichter Apr 29 '20 at 19:05