How to use the beamcoder.codecParameters function in beamcoder

To help you get started, we’ve selected a few beamcoder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Streampunk / beamengine / test / storeCodecParSpec.js View on Github external
test('Roundtrip codec parameters', async t => {
  let cps = beamcoder.codecParameters({
    name: 'h264',
    width: 1920,
    height: 1080,
    format: 'yuv422p',
    extradata: Buffer.from('Utter May!')
  });
  console.log(codecParToRedis(cps.toJSON()));
  let redis = new Redis();
  await redis.del('beam:codecpar:test');
  let start = process.hrtime();
  let cpr = codecParToRedis(cps.toJSON());
  console.log('codecParToRedis', process.hrtime(start));
  start = process.hrtime();
  t.equal(await redis.hmset('beam:codecpar:test', cpr), 'OK', 'redis says set OK.');
  console.log('redis set', process.hrtime(start));
github Streampunk / beamengine / test / storeCodecParSpec.js View on Github external
let start = process.hrtime();
  let cpr = codecParToRedis(cps.toJSON());
  console.log('codecParToRedis', process.hrtime(start));
  start = process.hrtime();
  t.equal(await redis.hmset('beam:codecpar:test', cpr), 'OK', 'redis says set OK.');
  console.log('redis set', process.hrtime(start));

  start = process.hrtime();
  let rcpb = await redis.hgetallBuffer('beam:codecpar:test');
  console.log('redis get', process.hrtime(start));

  start = process.hrtime();
  let rcpo = codecParFromRedis(rcpb);
  console.log('codecParFromRedis', process.hrtime(start));

  let rcp = beamcoder.codecParameters(rcpo);
  console.log(rcp);
  t.ok(rcp, 'roundtrip codec parameters is truthy.');
  await redis.quit();
  t.end();
});