2

I have used base64_decode to convert string to video file. But its very time consuming and lengthy process and it make postman app very slow.

Akshaya
  • 23
  • 1
  • 5
  • Hi, welcome to SO. Can you post a bit more about your question? What you tried etc See also https://stackoverflow.com/help/how-to-ask – cccnrc Dec 25 '19 at 11:25
  • why dont you send it as a binary file directly ? – N69S Dec 25 '19 at 11:29
  • I have used base_64 encode decode for this, and its working – Akshaya Dec 25 '19 at 11:36
  • $video = base64_decode($video_64); //actual image $video_url = "video_".time().".mp4"; if(isset($video) && isset($video_url)) { file_put_contents(public_path().'/videos/'.$video_url, $video); $video_path = $video_url; } – Akshaya Dec 25 '19 at 11:36
  • But its affecting postman app – Akshaya Dec 25 '19 at 11:37

1 Answers1

2

Please have a look at this link: Base64 video encoding - good\bad idea?

In short, using base64 alone for video transfer is not good for performance and bandwidth. To overcome this issue you have two options:

First option:

compress the base64 using gzip as suggested by @D-Marc in the mintioned link to reduce it's size. However, this will add th headache of compressing and decompressing on each request.

Second option:

use binary format for the video upload which is more concise and will save you a lot of headache. Which is best described by the chosen answer in the mentioned link.

Fahd Yousri
  • 401
  • 3
  • 12