Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/Konzertheld/bbb-slides-video-python
11 March 2025, 12:11:40 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/trunk
    No releases to show
  • d11fd66
  • /
  • main.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:53bc53ccb5134cd26a50a43e8bfee1fecabc56c9
origin badgedirectory badge Iframe embedding
swh:1:dir:d11fd6697fb7ac02c794648c81611abc27362ab0
origin badgerevision badge
swh:1:rev:a72ea88e1941cc4a64b468cf098cff7b44e0e158
origin badgesnapshot badge
swh:1:snp:35e840d11d026f8507df0b0cc81703f8f9c3c2a8
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: a72ea88e1941cc4a64b468cf098cff7b44e0e158 authored by Konzertheld on 10 July 2021, 16:16:37 UTC
fix crash when poll results are shown. Does not handle polls, just ignores them. related #2
Tip revision: a72ea88
main.py
import os
import sys
import urllib3
import xml.etree.ElementTree as ET
http = urllib3.PoolManager()

if len(sys.argv) > 1:
	# TODO: check if begins with http etc
	url_parts = sys.argv[1].split('/')
	base_url = '/'.join(url_parts[0:3])

	# check BBB version
	if "/2.0/" in sys.argv[1]:
		bbb_id = url_parts[len(url_parts) - 1].split('=')[1]
	elif "/2.3/" in sys.argv[1]:
		bbb_id = url_parts[len(url_parts) - 1]
	else:
		print("WARNING unsupported version")
		exit(1)

	shapes_url = base_url + "/presentation/" + bbb_id + "/shapes.svg"
	r = http.request('GET', shapes_url)
	if r.status == 404:
		print("WARNING 404")
		exit(2)
	shapes = r.data.decode('utf-8')
	shapes_xml_root = ET.fromstring(shapes)
	print("wget " + base_url + "/presentation/" + bbb_id + "/video/webcams.webm")
	print("ffmpeg -i webcams.webm -vn -c:a copy audio.ogg")  # read webcams write no video use same audio codec
	with open(os.getcwd() + '/parts.txt', 'w') as f:
		for child in shapes_xml_root:
			if 'image' in child.tag: # this ignores polls, drawn elements etc
				start_str = child.attrib["in"].split(".")[0]
				end_str = child.attrib["out"].split(".")[0]
				print("wget " + base_url + "/presentation/" + bbb_id + "/" + child.attrib['{http://www.w3.org/1999/xlink}href'] + " -O " + child.attrib["id"] + ".png")
				print("ffmpeg -loop 1 -i " + child.attrib["id"] + ".png -c:v libx264 -t " + str(int(end_str) - int(start_str)) + " -pix_fmt yuv420p -r 15.000150 " + child.attrib[
					"id"] + ".mp4")  # read image write using H264 use duration from shapes file, use frame rate from webcam file
				f.writelines(["file '" + child.attrib["id"] + ".mp4'\n"])

	print("ffmpeg -f concat -safe 0 -i " + os.getcwd() + "/parts.txt -c copy slides.mp4")  # read list from file, use same codecs
	print("ffmpeg -i slides.mp4 -i audio.ogg -c copy final.mp4") # read video-only and audio-only, output using same codec
else:
	print("No argument supplied, call with BBB URL")

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API