├── index.html ├── LICENSE ├── worker-asm.js ├── server.js ├── README.md ├── audio-plus-canvas-recording.html ├── webm-to-mp4.html ├── video-cropping.html ├── wav-to-ogg.html ├── wav-to-aac.html ├── merging-wav-and-webm-into-mp4.html └── audio-plus-screen-recording.html /index.html: -------------------------------------------------------------------------------- 1 |
    2 |
  1. wav-to-aac.html
  2. 3 |
  3. wav-to-ogg.html
  4. 4 |
  5. webm-to-mp4.html
  6. 5 |
  7. merging-wav-and-webm-into-mp4.html
  8. 6 |
  9. audio-plus-canvas-recording.html
  10. 7 |
  11. audio-plus-screen-recording.html
  12. 8 |
  13. video-cropping.html
  14. 9 |
-------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 [Muaz Khan](https://github.com/muaz-khan) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /worker-asm.js: -------------------------------------------------------------------------------- 1 | // this file is used to run ffmpeg_asm.js! 2 | // however, it is included in the HTML as "processInWebWorker" method instead of linking as a separate javascript file! 3 | 4 | importScripts('https://googledrive.com/host/0B6GWd_dUUTT8OEtLRGdQb2pibDg/ffmpeg_asm.js'); 5 | 6 | var now = Date.now; 7 | 8 | function print(text) { 9 | postMessage({ 10 | 'type' : 'stdout', 11 | 'data' : text 12 | }); 13 | } 14 | 15 | onmessage = function(event) { 16 | 17 | var message = event.data; 18 | 19 | if (message.type === "command") { 20 | 21 | var Module = { 22 | print: print, 23 | printErr: print, 24 | files: message.files || [], 25 | arguments: message.arguments || [], 26 | TOTAL_MEMORY: message.TOTAL_MEMORY || false 27 | // Can play around with this option - must be a power of 2 28 | // TOTAL_MEMORY: 268435456 29 | }; 30 | 31 | postMessage({ 32 | 'type' : 'start', 33 | 'data' : Module.arguments.join(" ") 34 | }); 35 | 36 | postMessage({ 37 | 'type' : 'stdout', 38 | 'data' : 'Received command: ' + 39 | Module.arguments.join(" ") + 40 | ((Module.TOTAL_MEMORY) ? ". Processing with " + Module.TOTAL_MEMORY + " bits." : "") 41 | }); 42 | 43 | var time = now(); 44 | var result = ffmpeg_run(Module); 45 | 46 | var totalTime = now() - time; 47 | postMessage({ 48 | 'type' : 'stdout', 49 | 'data' : 'Finished processing (took ' + totalTime + 'ms)' 50 | }); 51 | 52 | postMessage({ 53 | 'type' : 'done', 54 | 'data' : result, 55 | 'time' : totalTime 56 | }); 57 | } 58 | }; 59 | 60 | postMessage({ 61 | 'type' : 'ready' 62 | }); 63 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | // http://127.0.0.1:9001 2 | // http://localhost:9001 3 | 4 | var server = require('http'), 5 | url = require('url'), 6 | path = require('path'), 7 | fs = require('fs'); 8 | 9 | function serverHandler(request, response) { 10 | var uri = url.parse(request.url).pathname, 11 | filename = path.join(process.cwd(), uri); 12 | 13 | fs.exists(filename, function(exists) { 14 | if (!exists) { 15 | response.writeHead(404, { 16 | 'Content-Type': 'text/plain' 17 | }); 18 | response.write('404 Not Found: ' + filename + '\n'); 19 | response.end(); 20 | return; 21 | } 22 | 23 | if (filename.indexOf('favicon.ico') !== -1) { 24 | return; 25 | } 26 | 27 | var isWin = !!process.platform.match(/^win/); 28 | 29 | if (fs.statSync(filename).isDirectory() && !isWin) { 30 | filename += '/index.html'; 31 | } else if (fs.statSync(filename).isDirectory() && !!isWin) { 32 | filename += '\\index.html'; 33 | } 34 | 35 | fs.readFile(filename, 'binary', function(err, file) { 36 | if (err) { 37 | response.writeHead(500, { 38 | 'Content-Type': 'text/plain' 39 | }); 40 | response.write(err + '\n'); 41 | response.end(); 42 | return; 43 | } 44 | 45 | var contentType; 46 | 47 | if (filename.toString().toLowerCase().indexOf('html') != -1) { 48 | contentType = 'text/html'; 49 | } 50 | 51 | else if (filename.indexOf('.js') != -1) { 52 | contentType = 'application/javascript'; 53 | } 54 | 55 | if (contentType) { 56 | response.writeHead(200, { 57 | 'Content-Type': contentType 58 | }); 59 | } else response.writeHead(200); 60 | 61 | response.write(file, 'binary'); 62 | response.end(); 63 | }); 64 | }); 65 | } 66 | 67 | var app; 68 | 69 | app = server.createServer(serverHandler); 70 | 71 | app = app.listen(process.env.PORT || 9001, process.env.IP || "0.0.0.0", function() { 72 | var addr = app.address(); 73 | console.log("Server listening at", addr.address + ":" + addr.port); 74 | }); 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Ffmpeg Demos](https://github.com/muaz-khan/Ffmpeg.js) / [Demos](https://www.webrtc-experiment.com/ffmpeg/) 2 | 3 | | Demo Name | Demo | Code | 4 | | ------------- |-------------|-------------| 5 | | Transcoding WAV into AAC | [Demo](https://www.webrtc-experiment.com/ffmpeg/wav-to-aac.html) | [Source](https://github.com/muaz-khan/Ffmpeg.js/blob/master/wav-to-aac.html) | 6 | | Transcoding WAV into Ogg | [Demo](https://www.webrtc-experiment.com/ffmpeg/wav-to-ogg.html) | [Source](https://github.com/muaz-khan/Ffmpeg.js/blob/master/wav-to-ogg.html) | 7 | | Transcoding WebM into mp4 | [Demo](https://www.webrtc-experiment.com/ffmpeg/webm-to-mp4.html) | [Source](https://github.com/muaz-khan/Ffmpeg.js/blob/master/webm-to-mp4.html) | 8 | | Transcoding WebM into mp4; then merging WAV+mp4 into single mp4 | [Demo](https://www.webrtc-experiment.com/ffmpeg/merging-wav-and-webm-into-mp4.html) | [Source](https://github.com/muaz-khan/Ffmpeg.js/blob/master/merging-wav-and-webm-into-mp4.html) | 9 | | Recording Audio+Canvas and merging in single mp4 | [Demo](https://www.webrtc-experiment.com/ffmpeg/audio-plus-canvas-recording.html) | [Source](https://github.com/muaz-khan/Ffmpeg.js/blob/master/audio-plus-canvas-recording.html) | 10 | | Recording Audio+Screen and merging in single mp4 | [Demo](https://www.webrtc-experiment.com/ffmpeg/audio-plus-screen-recording.html) | [Source](https://github.com/muaz-khan/Ffmpeg.js/blob/master/audio-plus-screen-recording.html) | 11 | | Video Cropping | [Demo](https://www.webrtc-experiment.com/ffmpeg/video-cropping.html) | [Source](https://github.com/muaz-khan/Ffmpeg.js/blob/master/video-cropping.html) | 12 | 13 | Remember: [`ffmpeg-asm.js`](https://archive.org/download/ffmpeg_asm/ffmpeg_asm.js)'s credit goes to: https://github.com/bgrins/videoconverter.js 14 | 15 | * [audo-plus-canvas-recording.gif](https://cdn.webrtc-experiment.com/images/audo-plus-canvas-recording.gif) 16 | 17 | # File Size? 18 | 19 | **It is suggested to download `ffmpeg-asm` file and try locally!** 20 | 21 | [`ffmpeg-asm.js`](https://archive.org/download/ffmpeg_asm/ffmpeg_asm.js) file's default size is 18MB; however you can gzip it to make it about 6MB. 22 | 23 | # LocalHost 24 | 25 | ```sh 26 | node server.js 27 | ``` 28 | 29 | Now open `http://localhost:9001/`. 30 | 31 | # Disclaimer 32 | 33 | There is no warranty, expressed or implied, associated with this product. Use at your own risk. 34 | 35 | * https://www.webrtc-experiment.com/disclaimer/ 36 | 37 | # License 38 | 39 | [All these demos](https://github.com/muaz-khan/Ffmpeg.js) are released under [MIT licence](https://www.webrtc-experiment.com/licence/) . Copyright (c) [Muaz Khan](http://www.MuazKhan.com/). 40 | -------------------------------------------------------------------------------- /audio-plus-canvas-recording.html: -------------------------------------------------------------------------------- 1 | Audio + Canvas2D/HTML recording using RecordRTC! 2 | 3 | 4 | 5 | 6 | 7 | 65 | 66 |
67 |

68 | Audio + Canvas2D/HTML recording
using RecordRTC and ffmpeg! 69 |

70 |

Content is edit-able.

71 | 72 |
73 | 74 |

75 |
    76 |
  1. This demo uses HTML2Canvas Library along with RecordRTC to record/encode HTML snapshots (webp images) in WebM container.
  2. 77 |
  3. It also uses RecordRTC to record audio in WAV container.
  4. 78 |
  5. Then it uses ffmpeg-asm.js to transcode and merge both WAV/WebM in single MP4 container.
  6. 79 |
80 |
81 | 82 |
83 | 84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 300 | ←Try other Ffmpeg.js and RecordRTC demos 301 | -------------------------------------------------------------------------------- /webm-to-mp4.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | RecordRTC WebM to mp4 using ffmpeg-asm.js ® Muaz Khan 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 46 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 |

60 | RecordRTC WebM to mp4 using ffmpeg-asm.js! 61 |

62 |

63 | HOME 64 | © 65 | Muaz Khan 66 | 67 | . 68 | @WebRTCWeb 69 | 70 | . 71 | Github 72 | 73 | . 74 | Latest issues 75 | 76 | . 77 | What's New? 78 |

79 |
80 | 81 |
82 | 83 |
84 |

Logs

85 |
    86 |
  1. 87 | RecordRTC experiment converting WebM to mp4 inside the browser! 88 |
  2. 89 |
90 |
91 | 92 |
93 |

Record Video and convert into "mp4" using ffmpeg-asm.js!

94 | 95 |
96 | 97 | 98 |
99 | 100 |
101 |
102 |
103 | 254 | 255 |
256 |

Ffmpeg.js Issues 257 |

258 |
259 |
260 | 261 |
262 |

Feedback

263 |
264 | 265 |
266 | Enter your email too; if you want "direct" reply! 267 |
268 | 269 | 270 |
271 |

Using ffmpeg-asm.js...

272 |
    273 |
  1. 274 | WebM can be converted in mp4. 275 |
  2. 276 |
  3. 277 | WAV can be converted in ogg or mp3 (AAC/Vorbis). 278 |
  4. 279 |
  5. 280 | WAV can be merged in mp4. 281 |
  6. 282 |
283 |

284 | If WAV or WebM is 5MB in size; ogg, mp3 or mp4 will be 700kb! 285 |

286 |
287 | 288 |
289 |

290 | Ffmpeg.js is MIT licensed on Github! Documentation 291 |

292 |
293 | 294 |
295 |

Latest Updates

296 |
297 |
298 |
299 | 300 | 301 | 302 | 303 | 310 | 311 | 312 | 315 | 316 | 317 | 318 | -------------------------------------------------------------------------------- /video-cropping.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | RecordRTC Video Cropping using ffmpeg-asm.js ® Muaz Khan 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 46 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 |

60 | RecordRTC Video Cropping using ffmpeg-asm.js! 61 |

62 |

63 | HOME 64 | © 65 | Muaz Khan 66 | 67 | . 68 | @WebRTCWeb 69 | 70 | . 71 | Github 72 | 73 | . 74 | Latest issues 75 | 76 | . 77 | What's New? 78 |

79 |
80 | 81 |
82 | 83 |
84 |

Logs

85 |
    86 |
  1. 87 | RecordRTC experiment crops video inside the browser! 88 |
  2. 89 |
90 |
91 | 92 |
93 |

Record Video and convert into "mp4" using ffmpeg-asm.js!

94 | 95 |
96 | 97 | 98 |
99 | 100 |
101 |
102 |
103 | 255 | 256 |
257 |

Ffmpeg.js Issues 258 |

259 |
260 |
261 | 262 |
263 |

Feedback

264 |
265 | 266 |
267 | Enter your email too; if you want "direct" reply! 268 |
269 | 270 | 271 |
272 |

Using ffmpeg-asm.js...

273 |
    274 |
  1. 275 | WebM can be converted in mp4. 276 |
  2. 277 |
  3. 278 | WAV can be converted in ogg or mp3 (AAC/Vorbis). 279 |
  4. 280 |
  5. 281 | WAV can be merged in mp4. 282 |
  6. 283 |
284 |

285 | If WAV or WebM is 5MB in size; ogg, mp3 or mp4 will be 700kb! 286 |

287 |
288 | 289 |
290 |

291 | Ffmpeg.js is MIT licensed on Github! Documentation 292 |

293 |
294 | 295 |
296 |

Latest Updates

297 |
298 |
299 |
300 | 301 | 302 | 303 | 304 | 311 | 312 | 313 | 316 | 317 | 318 | 319 | -------------------------------------------------------------------------------- /wav-to-ogg.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | RecordRTC WAV to Ogg using ffmpeg-asm.js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 43 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
55 |
56 |

57 | RecordRTC WAV to Ogg using ffmpeg-asm.js! 58 |

59 |

60 | HOME 61 | © 62 | Muaz Khan 63 | 64 | . 65 | @WebRTCWeb 66 | 67 | . 68 | Github 69 | 70 | . 71 | Latest issues 72 | 73 | . 74 | What's New? 75 |

76 |
77 | 78 |
79 | 80 |
81 |

Logs

82 |
    83 |
  1. 84 | RecordRTC experiment converting WAV to Ogg inside the browser! 85 |
  2. 86 |
87 |
88 | 89 |
90 |

Record Audio and convert into "Ogg" using ffmpeg-asm.js!

91 | 92 |
93 | 94 |
95 | 96 | 97 |
98 |
99 |
100 | 267 | 268 |
269 |

Ffmpeg.js Issues 270 |

271 |
272 |
273 | 274 |
275 |

Feedback

276 |
277 | 278 |
279 | Enter your email too; if you want "direct" reply! 280 |
281 | 282 | 283 |
284 |

Using ffmpeg-asm.js...

285 |
    286 |
  1. 287 | WebM can be converted in mp4. 288 |
  2. 289 |
  3. 290 | WAV can be converted in ogg or mp3 (AAC/Vorbis). 291 |
  4. 292 |
  5. 293 | WAV can be merged in mp4. 294 |
  6. 295 |
296 |

297 | If WAV or WebM is 5MB in size; ogg, mp3 or mp4 will be 700kb! 298 |

299 |
300 | 301 |
302 |

303 | Ffmpeg.js is MIT licensed on Github! Documentation 304 |

305 |
306 | 307 |
308 |

Latest Updates

309 |
310 |
311 |
312 | 313 | 314 | 315 | 316 | 323 | 324 | 325 | 328 | 329 | 330 | 331 | -------------------------------------------------------------------------------- /wav-to-aac.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | RecordRTC WAV to ACC using ffmpeg-asm.js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 43 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
55 |
56 |

57 | RecordRTC WAV to ACC using ffmpeg-asm.js! 58 |

59 |

60 | HOME 61 | © 62 | Muaz Khan 63 | 64 | . 65 | @WebRTCWeb 66 | 67 | . 68 | Github 69 | 70 | . 71 | Latest issues 72 | 73 | . 74 | What's New? 75 |

76 |
77 | 78 |
79 | 80 |
81 |

Logs

82 |
    83 |
  1. 84 | RecordRTC experiment converting WAV to ACC inside the browser! 85 |
  2. 86 |
87 |
88 | 89 |
90 |

Record Audio and convert into "ACC" using ffmpeg-asm.js!

91 | 92 |
93 | 94 |
95 | 96 | 97 |
98 |
99 |
100 | 268 | 269 |
270 |

Ffmpeg.js Issues 271 |

272 |
273 |
274 | 275 |
276 |

Feedback

277 |
278 | 279 |
280 | Enter your email too; if you want "direct" reply! 281 |
282 | 283 | 284 |
285 |

Using ffmpeg-asm.js...

286 |
    287 |
  1. 288 | WebM can be converted in mp4. 289 |
  2. 290 |
  3. 291 | WAV can be converted in ogg or mp3 (AAC/Vorbis). 292 |
  4. 293 |
  5. 294 | WAV can be merged in mp4. 295 |
  6. 296 |
297 |

298 | If WAV or WebM is 5MB in size; ogg, mp3 or mp4 will be 700kb! 299 |

300 |
301 | 302 |
303 |

304 | Ffmpeg.js is MIT licensed on Github! Documentation 305 |

306 |
307 | 308 |
309 |

Latest Updates

310 |
311 |
312 |
313 | 314 | 315 | 316 | 317 | 324 | 325 | 326 | 329 | 330 | 331 | 332 | -------------------------------------------------------------------------------- /merging-wav-and-webm-into-mp4.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | RecordRTC Merging WebM/WAV into mp4 using ffmpeg-asm.js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 46 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 |

60 | RecordRTC Merging WebM/WAV into mp4 using ffmpeg-asm.js! 61 |

62 |

63 | HOME 64 | © 65 | Muaz Khan 66 | . 67 | @WebRTCWeb 68 | 69 | . 70 | Github 71 | 72 | . 73 | Latest issues 74 | 75 | . 76 | What's New? 77 |

78 |
79 | 80 |
81 | 82 |
83 |

Logs

84 |
    85 |
  1. 86 | RecordRTC experiment converting Merging WebM/WAV into mp4 inside the browser! 87 |
  2. 88 | 89 |
  3. 90 | ffmpeg-asm.js is integrated with RecordRTC by Gregory McGee! 91 |
  4. 92 |
93 |
94 | 95 |
96 |

Record audio/video and convert/merge into "mp4"!

97 | 98 |
99 | 100 | 101 |
102 | 103 |
104 |
105 |
106 | 335 | 336 |
337 |

Ffmpeg.js Issues 338 |

339 |
340 |
341 | 342 |
343 |

Feedback

344 |
345 | 346 |
347 | Enter your email too; if you want "direct" reply! 348 |
349 | 350 | 351 |
352 |

Using ffmpeg-asm.js...

353 |
    354 |
  1. 355 | WebM can be converted in mp4. 356 |
  2. 357 |
  3. 358 | WAV can be converted in ogg or mp3 (AAC/Vorbis). 359 |
  4. 360 |
  5. 361 | WAV can be merged in mp4. 362 |
  6. 363 |
364 |

365 | If WAV or WebM is 5MB in size; ogg, mp3 or mp4 will be 700kb! 366 |

367 |
368 | 369 |
370 |

371 | Ffmpeg.js is MIT licensed on Github! Documentation 372 |

373 |
374 | 375 |
376 |

Latest Updates

377 |
378 |
379 |
380 | 381 | 382 | 383 | 384 | 391 | 392 | 393 | 396 | 397 | 398 | 399 | -------------------------------------------------------------------------------- /audio-plus-screen-recording.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | Record audio+screen and get mp4! 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 46 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |
59 |
60 |

61 | Record audio+screen and get mp4! 62 |

63 |

64 | HOME 65 | © 66 | Muaz Khan 67 | . 68 | @WebRTCWeb 69 | 70 | . 71 | Github 72 | 73 | . 74 | Latest issues 75 | 76 | . 77 | What's New? 78 |

79 |
80 | 81 |
82 | 83 |
84 |

Logs

85 |
    86 |
  1. 87 | RecordRTC experiment converting Merging WebM/WAV into mp4 inside the browser! 88 |
  2. 89 | 90 |
  3. 91 | ffmpeg-asm.js is integrated with RecordRTC by Gregory McGee! 92 |
  4. 93 |
94 |
95 | 96 |
97 |

Record audio/screen and convert/merge into "mp4"!

98 | 99 |
100 | 101 | 102 |
103 | 104 |
105 |
106 |
107 | 371 | 372 |
373 |

Ffmpeg.js Issues 374 |

375 |
376 |
377 | 378 |
379 |

Feedback

380 |
381 | 382 |
383 | Enter your email too; if you want "direct" reply! 384 |
385 | 386 | 387 |
388 |

Using ffmpeg-asm.js...

389 |
    390 |
  1. 391 | WebM can be converted in mp4. 392 |
  2. 393 |
  3. 394 | WAV can be converted in ogg or mp3. 395 |
  4. 396 |
  5. 397 | WAV can be merged in mp4. 398 |
  6. 399 |
400 |

401 | If WAV or WebM is 5MB in size; ogg, mp3 or mp4 will be 700kb! 402 |

403 |
404 | 405 |
406 |

407 | RecordRTC is MIT licensed on Github! Documentation 408 |

409 |
410 | 411 |
412 |

Latest Updates

413 |
414 |
415 |
416 | 417 | 418 | 419 | 420 | 427 | 428 | 429 | 432 | 433 | 434 | 435 | --------------------------------------------------------------------------------