Search code examples
androidmobilevideo-streamingstreamingperformance-testing

Android Performance difference between saving video files or streaming to server


I'm planning to build a Android app that records a video feed and performs operations on each captured frame from the video. The current app structure follows:

  • Start recording video
  • Capture frame
  • Operate on frame
  • save frame to a single video file in external storage
  • Repeat

After recording a 45 second video, the video file in external storage would be sent over a network connection to a server. The video would be recorded at 1080p, 30 FPS.

I'm wondering if there would be a significant performance cost to streaming each frame to an external server instead of creating a video file on device for storage. I'm interested in whether or not streaming each frame would have a greater performance cost than saving each frame. If so, why is this the case? Thanks in advance!


Solution

  • On one hand you will have overhead in terms of data size as my expectation is that compressed video will be ~100x times less than thousands of source frames.

    On the other hand building up a video from frames will have a very high CPU footprint therefore will drain the battery.

    You can use Android Profiler to check which of the approaches will work faster and have minimal impact on the mobile device itself.

    From mobile device perspective (saving CPU and bandwidth) the best option is saving the video stream directly from camera onto your backend server and perform processing there. However in this case you will need to carefully measure performance of your server in order to ensure that it is capable of supporting anticipated amount of mobile users simultaneously uploading video files. See Load Testing Mobile Apps Made Easy article to get the overall idea regarding mobile devices backend performance testing.