Browse Source

generator and example files

master
Nils 3 months ago
parent
commit
a1e03a15a9
5 changed files with 200 additions and 1 deletions
  1. +1
    -1
      README.md
  2. +25
    -0
      example.ini
  3. BIN
      example/bach_air_bwv_1068.mp4
  4. +110
    -0
      example/index.html
  5. +64
    -0
      generator.py

+ 1
- 1
README.md View File

@@ -379,7 +379,7 @@ easier to record a video directly, without replacing the audio in post processin
Apparently OpenBroadCast Studio has a (complicated) way to offer multichannel JACK recordings, but
even if that works properly, the OBS setup also has some complexity.

`simple screen recorder`, my screen capture tool of choice only supports stereo audio via JACK.
`simplescreenrecorder`, my screen capture tool of choice only supports stereo audio.
Making the channel count a user setting would solve everything, but SSR is really tied to stereo audio,
so much that is already has comments about this in their code.


+ 25
- 0
example.ini View File

@@ -0,0 +1,25 @@
; example file to generate a video multitrack player website
; This file is just a trivial example, it doesn't reach copyright-level. No license needed.
[Information]
title=Bach Air BWV 1068
human=Example
date=2021-05-30
license=CC-0
description=Metronome click is muted by default. Raise the fader to hear it.<br>This is the example for <a href="https://git.laborejo.org/lss/Multichannel_Web_Video_Audio_Player_With_Volume_Mixer">the LSS multichannel player</a>.</p><p>Sorry, the midi-render does not include the repeat. It just jumps into the 2nd bracket.

videofile=bach_air_bwv_1068.mp4
; HTML5 and JavaScript cannot reliably figure this out. We already know the value, so setting it is the most robust solution.
samplerate=48000

; Track names need to be in the same order as the video files audio channels
; we assume stereo pairs. Each track is two consecutive channels
; Comma separated list. No spaces.
tracknames=Violin I,Violin II,Viola,Basso,Click

; Volume Map is one float value between 0 and 2 in steps of 0.01.
; 1 original volume level. So better don't go over 1, which means software amplification
; by the javascript engine.
; This is the initial / default position of the volume sliders, in the same order as the tracks
; Can be used to mute e.g. click tracks or conductor commentary by default.
; Comma separated list. No spaces.
volumemap=1,1,1,1,0

BIN
example/bach_air_bwv_1068.mp4 View File


+ 110
- 0
example/index.html View File

@@ -0,0 +1,110 @@
<!--
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )

This template for the multichannel video audio mixer, or the html page generated from it,
is part of a free software project.
While generator, javascript etc. are release under AGPLv3+ this document is
distributed under https://creativecommons.org/publicdomain/zero/1.0/ "Public Domain"
-->


<!-- https://www.blindtextgenerator.de/snippets -->
<!DOCTYPE html>

<html lang="en">

<meta charset="utf-8">

<head>
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC"> <!-- Deactivate favicon -->

<link rel="stylesheet" type="text/css" href="css/sanitize/sanitize.css" />
<link rel="stylesheet" type="text/css" href="css/sanitize/forms.css" />
<link rel="stylesheet" type="text/css" href="css/sanitize/typography.css" />

<link rel="stylesheet" type="text/css" href="css/design.css"/>

<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>

<!-- Filled in by the generator -->

<header>
<h1>Bach Air BWV 1068</h1>
<div class="subtitle"><small><b>Example</b> - 2021-05-30, CC-0</small></div>
</header>


<script>
var tracknames = [
"Violin I", "Violin II", "Viola", "Basso", "Click",
];

<!-- Initial / Default volume. Same order as tracks.-->
var volumeMap = [
1.0, 1.0, 1.0, 1.0, 0.0,
];

var videoAudioSampleRate = 48000 ;
</script>

<p>
<video controls>
<source id="videofilename" src="bach_air_bwv_1068.mp4" type="video/mp4">
</video>
</p>

<p>
<div id="mixerstrips" align="center">
<!-- filled in by javascript -->
</div>
</p>

<!-- Buttons for all tracks volume control -->
<p align="center">
<button onclick="setAllVolumeToZero()">[S] Silence All</button> <!-- All to zero. Not Mute like a DAW. -->
<button onclick="resetAllVolumeToDefault()">[R] Reset to Default</button> <!-- All to initial volumeMap (see above) -->
<button onclick="setAllVolumeToOne()">[H] Hear All</button> <!-- All to original video volume -->
<br> Use a <b>[number]</b> key to toggle tracks directly.
<br> <b>[Shift]</b> + <b>[number]</b> to set track to half volume.
</p>

<!-- Work in Progress. Does not yet work. Maybe in a later version
<hr>
<p align="center">
<button onclick="renderOfflineAndDownload()">Download Your Mix</button>
</p>
-->

<hr>

<p align="center">
<button onclick="playPause()">[Space] Play/Pause</button> <!-- Even if video is not in focus. -->
<button onclick="seek(5)">[➡] +5 sec</button> <!-- Even if video is not in focus. -->
<button onclick="seek(-5)">[⬅] -5 sec</button> <!-- Even if video is not in focus. -->
<button onclick="seek(30)">[⬆] +30 sec</button> <!-- Even if video is not in focus. -->
<button onclick="seek(-30)">[⬇] -30 sec</button> <!-- Even if video is not in focus. -->

</p>
<p align="center">
<button onclick="fasterPlaybackSpeed()">[D] Faster</button>
<button onclick="slowerPlaybackSpeed()">[A] Slower</button>
<button onclick="normalPlaybackSpeed()">[W] Normal Speed</button>
<br>Speed: &times;<span id="playbackSpeed">1.0</span>
</p>

<hr>

<p>
Metronome click is muted by default. Raise the fader to hear it.<br>This is the example for <a href="https://git.laborejo.org/lss/Multichannel_Web_Video_Audio_Player_With_Volume_Mixer">the LSS multichannel player</a>.</p><p>Sorry, the midi-render does not include the repeat. It just jumps into the 2nd bracket.
</p>

</body>
</html>

<!-- load video player file last. Uses data from this file in <script> above -->
<!-- <script type="text/javascript" src="js/wavyjs/wavyjs.js"></script> -->
<script type="text/javascript" src="js/videomixer.js"></script>


+ 64
- 0
generator.py View File

@@ -0,0 +1,64 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )

This multichannel video audio mixer is free software: you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>.

"""


import configparser
import sys

assert sys.argv[1]
assert sys.argv[1].endswith(".ini"), sys.argv[1]

config = configparser.ConfigParser()

config.read(sys.argv[1])

tracknames = config["Information"]["tracknames"].split(",")
tracknameshtmllist = ""
for trnm in tracknames:
tracknameshtmllist += f'"{trnm}", '

volumeMap = config["Information"]["volumemap"].split(",")
volumeHtmlList = ""
for vl in volumeMap:
volumeHtmlList += f'{round(float(vl), 2)}, '



with open("template.html", "r") as f:
template = f.read()
template = template.replace("$$$VIDEOFILE$$$", config["Information"]["videofile"])
template = template.replace("$$$TITLE$$$", config["Information"]["title"])
template = template.replace("$$$TRACKNAMES$$$", tracknameshtmllist)
template = template.replace("$$$VOLUMEMAP$$$", volumeHtmlList)
template = template.replace("$$$SAMPLERATE$$$", config["Information"]["samplerate"])
template = template.replace("$$$HUMAN$$$", config["Information"]["human"])
template = template.replace("$$$DATE$$$", config["Information"]["date"])
template = template.replace("$$$LICENSE$$$", config["Information"]["license"])
template = template.replace("$$$DESCRIPTION$$$", config["Information"]["description"])


print (template) #stdout. our job is done






Loading…
Cancel
Save