Are you over 18 and want to see adult content?
More Annotations
A complete backup of jaipuremotors.in
Are you over 18 and want to see adult content?
A complete backup of parkersofbolton.co.uk
Are you over 18 and want to see adult content?
A complete backup of chestofbooks.com
Are you over 18 and want to see adult content?
A complete backup of thepropertymanagementcoach.com
Are you over 18 and want to see adult content?
A complete backup of fingering-myself.tumblr.com
Are you over 18 and want to see adult content?
A complete backup of bigfigmattress.com
Are you over 18 and want to see adult content?
Favourite Annotations
A complete backup of pinewreathandcandle.com
Are you over 18 and want to see adult content?
A complete backup of sparkprofits.com
Are you over 18 and want to see adult content?
A complete backup of animation-books.blogspot.com
Are you over 18 and want to see adult content?
A complete backup of messengernews.net
Are you over 18 and want to see adult content?
A complete backup of casterindustries.com
Are you over 18 and want to see adult content?
A complete backup of timeoutdoors.com
Are you over 18 and want to see adult content?
A complete backup of html5gameengine.com
Are you over 18 and want to see adult content?
Text
* Home
* PHP
* PHP
* PHP Functions
* PHP Security
* PHP Interviews Questions * LIVE Project Problem * Web Site Performance * Twitter Integration* Databases
* MYSQL Technology
* MYSQLI Technology
* MYSQL Query
* MySQL Interview Questions and Answer* MongoDB
* LIVE Project Problem * MySQL Console Commands* Framework / CMS
* Zend Framework 1
* Zend Framework 2
* Joomla
* Magento
* Wordpress
* CakePHP
* Laravel
* Frontend
* NodeJS
* jQuery
* JavaScript
* JavaScript Interview* Ajax
* Fronted Interview Questions & Answer* Google Map
* Ajax Interview Questions & Answer * Website Performance* JSON
* CSS Interview Questions & Answer* Fckeditor
* jQuery Plugin
* EmberJS Framework
* JW Player Integration* EmberJS Framework
* Interview Questions * All Interview Questions * PHP Interview Questions * MySQL Interview Questions * JavaScript Interview * Interview Questions* Zend Interview
* Ajax Interview
* CSS Interview
* Cakephp Interview Questions * Soap Interview Questions * Apache Interview Questions * JSON Interview Questions * XML Interview Questions * Joomla Interview Questions * Bootstrap Interview Questions * Node Js Interview Questions * Wordpress Interview * OOPs Interview Questions * Web Services / API* Web Services
* Facebook Integration * Paypal Integration in Website* APIs
* Braintree Quick Integration * Google map integration * Amazon Integration * Twitter Interation * Android Interation * Youtube Interation * OpenInviter Interation * jwplayer Interation* Web Development
* Web Development Tools* Htaccess
* Unix Commands
* Email Integration
* Linux
* Regular Expression* SVN
* MS Excel
* Hadoop
* Server
* Streaming
* Wamp Server
* GitHub
* Design Pattern
* XML
* Nginx
* Share your website* Xpath
* Site Map
MONDAY, 9 SEPTEMBER 2019 HOW AZURE FUNCTIONS CAN CONVERT MP4 TO MP3 WITH NODE USING FFMPEG?PRE-REQUISITE
* You have created a function with with name "convert-audio" * You have downloaded and uploaded ffmpeg files (ffmpeg.exe) in "site -> wwwroot-> bin" * You have created a folder with name wav_to_mp3 "site -> wwwroot->wav_to_mp3"
SOURCE CODE
//Download the Required module const http = require('https'); const fs = require('fs'); const childProcess = require('child_process');//Define constants
const VIDEO_PATH = 'wav_to_mp3/'; const ffmpegLib='bin/ffmpeg'; module.exports = async function (context, req) { ////////////// params declaration let bodyData=req.body; let audioFile=bodyData.audio_file; let videoFile=bodyData.video_file; let extension=bodyData.extension; if (audioFile && videoFile && extension) { if(fs.existsSync(VIDEO_PATH+videoFile)){ await ffmpegConvertVideoToAudio(VIDEO_PATH+videoFile,VIDEO_PATH+audioFile,extension).then(data=>{ messageData(200,{success:1,'msg':'',result:{audio_file:data.filename}});});
}else{
messageData(200,{success:0,msg:"video_file does not exist",'result':{}});}
} else {
messageData(200,{success:0,msg:"Parameter missing (audio_file OR video_file OR extension)",'result':{}});}
//for print the message function messageData(statusCode,message){context.res = {
status: statusCode,body: message,
headers: {
'Content-Type': 'application/json'}
};
context.done();
}
};
///////////////////////////// Other Functions //////////////////////////////////// function ffmpegConvertVideoToAudio(sourcefile, destinationFile, extension) { return new Promise(function(resolve, reject) { let result={success:0,'msg':'',filename:destinationFile}; console.log('ffmpegConvertVideoToAudio called '+destinationFile);var args = ;
var proc = childProcess.spawnSync(ffmpegLib, args);result.success=1
resolve(result);
});
}
///////////////////////////// Other Functions //////////////////////////////////// URL: https://function-name.azurewebsites.net/api/convert-audioMETHOD: POST
REQUEST:
{"video_file":"0_20190821064650782.mp4","audio_file":"arun.mp3","extension":"mp3"}RESPONSE:
{
"success": 1,
"msg": "",
"result": {
"audio_file": "wav_to_mp3/arun.mp3"}
}
URL: https://function-name.azurewebsites.net/api/convert-audioMETHOD: POST
REQUEST:
{"video_file":"0_20190821064650782.mp4","audio_file":"arun.flac","extension":"flac"}RESPONSE:
{
"success": 1,
"msg": "",
"result": {
"audio_file": "wav_to_mp3/arun.flac"}
}
Reactions:
Links to this post
FRIDAY, 6 SEPTEMBER 2019 DOWNLOAD THE MEDIA FILES WITH NODE IN AZURE SERVERLESS PRE-REQUISITE FOR NODE IN AZURE SERVERLESS * You have created a function with with name "download-files" * You have downloaded ffmpeg files (ffmpeg.exe) in "site ->wwwroot-> bin"
* You have created a folder with name wav_to_mp3 "site -> wwwroot->wav_to_mp3"
SOURCE CODE
//Download the Required module const http = require('https'); const fs = require('fs'); //const childProcess = require('child_process'); const path = require('path');//Define constants
const VIDEO_PATH = 'wav_to_mp3/'; const ffmpegLib='bin/ffmpeg'; module.exports = function (context, req) { ////////////// params declaration let bodyData=req.body; let tourStreamName=bodyData.tour_stream_name; let videoUrls=bodyData.url;let filename='';
let filenameSuccessLog={}; let completedCounter=0; if (tourStreamName && videoUrls.length>0) { ////////////////////// ALL VIDEOS DOWNLOAD //////////////////////////// //const forLoop = async _ => { videoUrls.forEach(async (url) => { filename=path.basename(url); // let videoDownload=VIDEO_PATH+filename; //full video url, filename, force download downloadFileAsync(url,filename,0).then(data=>{ filenameSuccessLog=data.success;completedCounter++;
if(videoUrls.length==completedCounter){ messageData(200,{success:1,'msg':'',result:filenameSuccessLog});}
});
})
//}
//forLoop();
////////////////////// ALL VIDEOS DOWNLOAD ////////////////////////////} else {
messageData(200,{success:0,msg:"Parameter missing (tour_stream_name OR url)",'result':{}});}
//for print the message function messageData(statusCode,message){context.res = {
status: statusCode,body: message,
headers: {
'Content-Type': 'application/json'}
};
context.done();
}
};
///////////////////////////// Other Functions /////////////////////////////////////**
* @url: url of video * @destination: file with name download in wav_to_mp3 * @forcedownload: 1 means download again even*/
async function downloadFileAsync(url, destination,forcedownload) { return new Promise(function(resolve, reject) { let result={success:0,'msg':'',filename:destination}; if (fs.existsSync(VIDEO_PATH+destination) && forcedownload==0) {result.success=1
resolve(result);
}else{
const file = fs.createWriteStream(VIDEO_PATH+destination); const request = http.get(url, (res) => {res.pipe(file);
});
request.once('error', (error) =>{
result.msg=error;
reject(result);
}
);
file.once('finish', () =>{
result.success=1
resolve(result);
}
);
}
})
}
///////////////////////////// Other Functions //////////////////////////////////// URL: https://function-name.azurewebsites.net/api/download-filesMETHOD: POST
REQUEST:
{"tour_stream_name":"arun","url":}RESPONSE:
{
"success": 1,
"msg": "",
"result": {
"tq_33038dev-GM-ma9kW-1106-26079.mp4": 1, "0_20190821064650782.mp4": 1}
}
Reactions:
Links to this post
Labels: Azure
, FFMPEG
, Serverless ArchitectureOlder Posts
Home
Subscribe to: Posts ( Atom )LEARN BY VIDEOS
* BootStrap JS Videos* MongoDB Videos
* MySQL Videos
* Node JS Videos
* PHP Videos
GOOGLE SEARCH
RECENT UPDATED
*
PHP Magic Methods with Examples*
How to Setup Password Authentication For AWS ec2 Instances*
Unix questions and answers for Root user*
What is RTMP, RTMPT, RTMPE, RTMPTE and RTMPS protocol?*
AWS interview questions and answers for 2 year experiencedTAGS
* agora
( 1 )
* Ajax
( 16 )
* Ajax Interview Questions and Answers( 5 )
* Amazon
( 8 )
* Android
( 5 )
* angularjs
( 1 )
* API
( 10 )
* AWS
( 26 )
* aws-interview-questions( 14 )
* Azure
( 5 )
* Bootstrap
( 2 )
* Braintree
( 7 )
* cakephp
( 6 )
* Cakephp Interview Questions( 8 )
* CSS Interview Questions and Answers( 3 )
* CURL
( 4 )
* database
( 2 )
* DBMS
( 2 )
* Definations
( 1 )
* Design Pattern
( 1 )
* Difference between( 23 )
( 11 )
* emberjs
( 2 )
* Excel
( 2 )
* ExpressJs
( 10 )
( 22 )
* Fckeditor
( 3 )
* FFMPEG
( 10 )
* Frontend Interview Questions and Answers( 18 )
* GitHub
( 1 )
* Google map integration( 7 )
* google-cloud
( 3 )
* Hadoop
( 2 )
* htaccess
( 12 )
* Interview Questions and Answers( 55 )
* IOS
( 1 )
* iptables
( 1 )
* JavaScript
( 15 )
* Javascript Interview Questions and Answers( 21 )
* joomla
( 3 )
* jquery
( 21 )
* jQuery Interview Questions( 12 )
* jQuery plugin
( 2 )
* JSON
( 5 )
* jwplayer
( 2 )
* Laravel
( 4 )
* Linux
( 7 )
* Magento
( 1 )
* Model
( 3 )
* MongoDB
( 27 )
* Mongoose
( 5 )
* multilingual websites( 3 )
* MYSQL
( 32 )
* Mysql Console Commands( 1 )
* MYSQL Interview Questions( 29 )
* mysql query
( 3 )
* MySQLI
( 3 )
* nginx
( 1 )
* Node Interview Questions and Answers( 4 )
* NodeJS
( 48 )
* NodeJS-async
( 1 )
* NodeJS-expressjs
( 3 )
* NodeJS-mocha
( 1 )
* NodeJS-request
( 1 )
* NodeJS-socket
( 3 )
* NodeJS-underscore
( 2 )
* OOP
( 5 )
* OpenInviter
( 2 )
* paypal
( 17 )
* php
( 17 )
* PHP Functions
( 62 )
* PHP Interviews Questions( 51 )
* php problem solutions( 50 )
* PHP security
( 29 )
* Reactjs
( 2 )
* redis
( 4 )
* Regular Expression( 5 )
* rev
( 1 )
* Server
( 3 )
* share
( 1 )
* Shell Script
( 9 )
* Software Development( 54 )
* Streaming
( 2 )
* SVN
( 5 )
* Symfony
( 2 )
* Topics
( 13 )
( 5 )
* Unix Commands
( 23 )
* voicebase
( 1 )
* Wamp Server
( 3 )
* Web Services
( 38 )
* Web socket
( 2 )
* web-rtc
( 1 )
* Website Performance( 5 )
* Wordpress
( 13 )
* XML
( 1 )
* Xpath
( 1 )
* YouTube
( 6 )
* Zend Framework
( 35 )
* Zend Framework Interview Questions and Answers( 6 )
* ZF2
( 25 )
FOLLOW US
SHARE
www.web-technology-experts-notes.in . Powered by Blogger.
* Home |
* Contact Us |
* Chat |
* About US |
* Privacy Policy / T&C|
* Site Map |
Details
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0