Update project name to ffprobe-wasm.

This commit is contained in:
Alf
2020-11-09 21:17:52 -08:00
parent fc142e8ab1
commit af5a5aeaf7
13 changed files with 40 additions and 24 deletions

View File

@@ -78,7 +78,7 @@ RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \
emmake make install emmake make install
COPY ./src/ffprobe-web-analyzer-wrapper.cpp /build/src/ffprobe-web-analyzer-wrapper.cpp COPY ./src/ffprobe-wasm-wrapper.cpp /build/src/ffprobe-wasm-wrapper.cpp
COPY ./Makefile /build/Makefile COPY ./Makefile /build/Makefile
WORKDIR /build WORKDIR /build

View File

@@ -1,4 +1,4 @@
dist/ffprobe-web-analyzer.js: dist/ffprobe-wasm.js:
mkdir -p dist && \ mkdir -p dist && \
emcc --bind \ emcc --bind \
-O3 \ -O3 \
@@ -8,5 +8,5 @@ dist/ffprobe-web-analyzer.js:
-s INITIAL_MEMORY=268435456 \ -s INITIAL_MEMORY=268435456 \
-pthread \ -pthread \
-lavcodec -lavformat -lavfilter -lavdevice -lswresample -lswscale -lavutil -lm -lx264 -pthread \ -lavcodec -lavformat -lavfilter -lavdevice -lswresample -lswscale -lavutil -lm -lx264 -pthread \
-o dist/ffprobe-web-analyzer.js \ -o dist/ffprobe-wasm.js \
src/ffprobe-web-analyzer-wrapper.cpp src/ffprobe-wasm-wrapper.cpp

View File

@@ -1,7 +1,7 @@
# `FFProbe Web Analyzer` # `FFProbe Wasm`
> A Web-based FFProbe. Powered by FFmpeg, Vue and Web Assembly! 🦀. > A Web-based FFProbe. Powered by FFmpeg, Vue and Web Assembly! 🦀.
https://alfg.github.io/ffprobe-web-analyzer/ https://alfg.github.io/ffprobe-wasm/
⚠️ A work-in-progress! Check back for updates! ⚠️ A work-in-progress! Check back for updates!
@@ -9,7 +9,7 @@ https://alfg.github.io/ffprobe-web-analyzer/
## Development ## Development
`ffprobe-web-analyzer` uses [emscripten](https://emscripten.org/) to compile [FFmpeg](https://ffmpeg.org)'s [libav](https://ffmpeg.org/doxygen/4.1/index.html) to [Web Assembly](https://webassembly.org/) via [Docker](https://www.docker.com/). `ffprobe-wasm` uses [emscripten](https://emscripten.org/) to compile [FFmpeg](https://ffmpeg.org)'s [libav](https://ffmpeg.org/doxygen/4.1/index.html) to [Web Assembly](https://webassembly.org/) via [Docker](https://www.docker.com/).
Emscripten is also used to create and compile the Wasm bindings to be imported by the browser. Emscripten is also used to create and compile the Wasm bindings to be imported by the browser.
@@ -20,7 +20,7 @@ Emscripten is also used to create and compile the Wasm bindings to be imported b
### Setup ### Setup
* Clone project and build the Wasm module via Docker: * Clone project and build the Wasm module via Docker:
``` ```
docker-compose run ffprobe-web-analyzer make docker-compose run ffprobe-wasm make
``` ```
This will build the Wasm module and place it into the `/dist` directory. This will build the Wasm module and place it into the `/dist` directory.

View File

@@ -1,5 +1,5 @@
mkdir -p dist mkdir -p dist
docker build -t ffprobe-web-analyzer . docker build -t ffprobe-wasm .
docker create -ti --name ffprobe-web-analyzer-container ffprobe-web-analyzer docker create -ti --name ffprobe-wasm-container ffprobe-wasm
docker cp ffprobe-web-analyzer-container:/build/dist/ . docker cp ffprobe-wasm-container:/build/dist/ www
docker rm -fv ffprobe-web-analyzer-container docker rm -fv ffprobe-wasm-container

View File

@@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
ffprobe-web-analyzer: ffprobe-wasm:
build: . build: .
volumes: volumes:
- "./:/build" - "./:/build"

View File

@@ -96,6 +96,21 @@ FileInfoResponse get_file_info() {
} }
fourcc[4] = 0x00; // NULL terminator. fourcc[4] = 0x00; // NULL terminator.
AVCodec *pLocalCodec = avcodec_find_decoder(pLocalCodecParameters->codec_id);
if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_VIDEO) {
if (video_stream_index == -1) {
video_stream_index = i;
pCodec = pLocalCodec;
pCodecParameters = pLocalCodecParameters;
}
printf("Video Codec: resolution %d x %d",
pLocalCodecParameters->width, pLocalCodecParameters->height);
} else if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_AUDIO) {
printf("Audio Codec: %d channels, sample rate %d",
pLocalCodecParameters->channels, pLocalCodecParameters->sample_rate);
}
Stream stream = { Stream stream = {
.id = (int)pFormatContext->streams[i]->id, .id = (int)pFormatContext->streams[i]->id,
.start_time = (int)pFormatContext->streams[i]->start_time, .start_time = (int)pFormatContext->streams[i]->start_time,
@@ -141,6 +156,7 @@ EMSCRIPTEN_BINDINGS(FileInfoResponse_struct) {
.field("frame_size", &Stream::frame_size) .field("frame_size", &Stream::frame_size)
; ;
register_vector<Stream>("Stream"); register_vector<Stream>("Stream");
emscripten::value_object<FileInfoResponse>("FileInfoResponse") emscripten::value_object<FileInfoResponse>("FileInfoResponse")
.field("name", &FileInfoResponse::name) .field("name", &FileInfoResponse::name)
.field("duration", &FileInfoResponse::duration) .field("duration", &FileInfoResponse::duration)

2
www/package-lock.json generated
View File

@@ -1,5 +1,5 @@
{ {
"name": "ffprobe-web-analyzer", "name": "ffprobe-wasm",
"version": "0.0.1", "version": "0.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,

View File

@@ -1,5 +1,5 @@
{ {
"name": "ffprobe-web-analyzer", "name": "ffprobe-wasm",
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View File

@@ -12,7 +12,7 @@
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<script src="ffprobe-web-analyzer.js"></script> <script src="ffprobe-wasm.js"></script>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
</html> </html>

View File

@@ -4,7 +4,7 @@
<div class="container"> <div class="container">
<b-navbar-nav> <b-navbar-nav>
<b-nav-item href="#"> <b-nav-item href="#">
FFProbe Web Analyzer FFProbe
</b-nav-item> </b-nav-item>
</b-navbar-nav> </b-navbar-nav>
</div> </div>
@@ -13,7 +13,7 @@
<GitHubCorner /> <GitHubCorner />
<div id="app" class="container"> <div id="app" class="container">
<h3>FFProbe Web Analyzer</h3> <h3>FFProbe</h3>
<b-alert variant="warning" show> <b-alert variant="warning" show>
Compatible with Chrome and Edge only due to limited support for <a href="https://caniuse.com/sharedarraybuffer">SharedArrayBuffer</a> and the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer">required CORS headers</a> for Firefox on Github Pages. Compatible with Chrome and Edge only due to limited support for <a href="https://caniuse.com/sharedarraybuffer">SharedArrayBuffer</a> and the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer">required CORS headers</a> for Firefox on Github Pages.
@@ -28,8 +28,8 @@
<div class="text-muted"> <div class="text-muted">
<ul> <ul>
<li>{{ name }}-{{ version }}</li> <li>{{ name }}-{{ version }}</li>
<li><a href="https://github.com/alfg/ffprobe-web-analyzer">Source</a></li> <li><a href="https://github.com/alfg/ffprobe-wasm">Source</a></li>
<li><a href="https://github.com/alfg/ffprobe-web-analyzer/issues">Report Bugs</a></li> <li><a href="https://github.com/alfg/ffprobe-wasm/issues">Report Bugs</a></li>
</ul> </ul>
</div> </div>
</footer> </footer>

View File

@@ -3,7 +3,7 @@
<b-form-group label="Select a file:" label-for="file"> <b-form-group label="Select a file:" label-for="file">
<b-form-file <b-form-file
id="file" id="file"
accept="video/mp4" accept="video/*"
v-model="file" v-model="file"
:state="Boolean(file)" :state="Boolean(file)"
placeholder="Choose a file or drop it here..." placeholder="Choose a file or drop it here..."

View File

@@ -1,7 +1,7 @@
<template> <template>
<!-- http://tholman.com/github-corners/ --> <!-- http://tholman.com/github-corners/ -->
<a <a
href="https://github.com/alfg/ffprobe-web-analyzer" href="https://github.com/alfg/ffprobe-wasm"
class="github-corner" class="github-corner"
aria-label="View source on GitHub" aria-label="View source on GitHub"
> >

View File

@@ -2,11 +2,11 @@ module.exports = {
pages: { pages: {
index: { index: {
entry: 'src/main.js', entry: 'src/main.js',
title: 'FFProbe Web Analyzer', title: 'FFProbe',
} }
}, },
publicPath: process.env.NODE_ENV === 'production' publicPath: process.env.NODE_ENV === 'production'
? '/ffprobe-web-analyzer/' ? '/ffprobe-wasm/'
: '/', : '/',
configureWebpack: { configureWebpack: {
devServer: { devServer: {