📲 On Device Video Encoding 📲 | Research & Experiments Department of 3Speak 😉

Preview of On Device Encoding

Background

  • Video encoding is heavy CPU task
  • At the moment, almost all the users' videos are being encoded by 3Speak Infrastructure
  • This is more of a centralised solution
  • 3Speak would like to shift to decentralised solution

Current Solution

WHY PART

  • No solution is perfect.
  • Everything is we do - is a journey towards - excellence & perfection.
  • At the moment, there are some challenges in current solution which is rolled out for beta users.
  • I, as an individual, want to explore entirely different approach
  • I call that approach - On-device-video encoding.
  • AGAIN - BUT - WHY?
  • I want our users as independent as possible.
  • User should be able to encode their own video
  • User should be able to self-host their own video
  • User should be able to use their own infrastructure
  • With this solution, I want to give power back to the community
  • I want to empower individual members

What is On-Device-Encoding?

  • You can use your mobile-device to encode your own video.
  • I am sure you must have tried many apps like these
  • If not, you can try searching for "Video compression" on AppStore or PlayStore.
    On Device Encoding

For whom

  • This solution is for those who wants to encode their own video
  • Upload on their own (self host)
  • And publish without relying on 3Speak infrastructure or 3Speak Video Encoders
  • To be precise, For those who don't want to wait for their video to be encoded by others.

Okay but tell me HOW.

  • Everything I do is open source.
  • HOW part is done by code & it's available to read on the github.
  • Code is at the moment commented out (because it's not production ready)
  • Here is the link to the experimental code

Give me Explicit code.

    var pathToEncoding = '${externalDir.path}/encoding';
    var encodingDirPath = Directory(pathToEncoding);
    var exists = await encodingDirPath.exists();
    if (exists) {
      await encodingDirPath.delete(recursive: true);
    }
    var encodingDir = await Directory(encodingDirPath.path).create();
    var encoding480Dir = await Directory('${encodingDir.path}/480').create();
    var encoding720Dir = await Directory('${encodingDir.path}/720').create();
    var encoding1080Dir = await Directory('${encodingDir.path}/1080').create();
    var resultOf480Resize = await FFmpegKit.execute(
        "-i ${file.path} -vf scale=480:-1  ${encoding480Dir.path}/output.mp4");
    log('480 done');
    var resultOf720Resize = await FFmpegKit.execute(
        "-i ${file.path} -vf scale=720:-1 ${encoding720Dir.path}/output.mp4");
    log('720 done');
    var resultOf1080Resize = await FFmpegKit.execute(
        "-i ${file.path} -vf scale=1080:-1 ${encoding1080Dir.path}/output.mp4");
    log('1080 done');
  • What language? - It's DART programming language
  • Which Library? - FFmpeg for flutter
  • Of course, code written above is NOT perfect
  • I want feedback from community.
  • Those who have knowledge, I request them to guide me to accomplish this task

NOOO ! I don't want to use mobile. I want to use DESKTOP.

  • Okay Cool. I get that your mobile is something you don't want to use for video-encoding.
  • Just download Android Emulator (available for any operating system)
  • Install app
  • Start encoding video on your DESKTOP - Problem solved.

Okay. Video encoded. What's next?

  • Once we have a valid solution working for On Device Video Encoding,
  • I would like to switch to self-hosting.

Feedback / Thoughts / Inputs / Suggestions

  • I want to know what community thinks about this approach.
  • I want to know what is the expectation from Community.
  • Please READ my post, Re-Share, upvote 🙏

Who am I?


Support Me Back 🙏

Support 3Speak

Download Android AppVote me as Hive WitnessDownload iOS App
Join 3Speak DiscordSetup Encoder NodeVote for 3Speak Proposal
Earn Money using HoneyGainGet a server

Cheers
Have a good one

H2
H3
H4
3 columns
2 columns
1 column
4 Comments
Ecency