Set up project:
mkdir project
cd project
npm init -y
<?php | |
// https://laravel.io/forum/09-23-2014-how-to-support-http-byte-serving-in-file-streams | |
// Provide a streaming file with support for scrubbing | |
private function streamFile( $contentType, $path ) { | |
$fullsize = filesize($path); | |
$size = $fullsize; | |
$stream = fopen($path, "r"); | |
$response_code = 200; | |
$headers = array("Content-type" => $contentType); | |
Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma
You can get the list of supported formats with:
ffmpeg -formats
Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:
<?php | |
function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) { | |
static $filesize = null; | |
switch ($notification_code) { | |
case STREAM_NOTIFY_RESOLVE: | |
case STREAM_NOTIFY_AUTH_REQUIRED: | |
case STREAM_NOTIFY_COMPLETED: | |
case STREAM_NOTIFY_FAILURE: |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" /> | |
<!-- when.js Promises implementation --> | |
<script src="https://raw.github.com/cujojs/when/master/when.js"></script> | |
<!-- Unit testing and mocking framework --> | |
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script> |
import random | |
import math | |
import timeit | |
import matplotlib.pyplot as plt | |
timeBubble = [] | |
timeSelection = [] | |
timeInsertion = [] | |
timeQuick = [] | |
timeMerge = [] |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", |
function bytesToSize(bytes) { | |
if(bytes == 0) return '0 Byte'; | |
var k = 1000; | |
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; | |
var i = Math.floor(Math.log(bytes) / Math.log(k)); | |
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i]; | |
} |
<?php | |
/** | |
* Download helper to download files in chunks and save it. | |
* | |
* @author Syed I.R <syed@lukonet.com> | |
* @link https://github.com/irazasyed | |
* | |
* @param string $srcName Source Path/URL to the file you want to download | |
* @param string $dstName Destination Path to save your file | |
* @param integer $chunkSize (Optional) How many bytes to download per chunk (In MB). Defaults to 1 MB. |
import { | |
Component, | |
OnInit, | |
Output, | |
Input, | |
ComponentFactoryResolver, | |
OnDestroy, | |
ViewContainerRef, ViewChild, ComponentRef, AfterViewInit, Inject, Optional | |
} from '@angular/core'; | |
import {PAYSTACK_KEY} from './paystack-key.token'; |