Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use-a-Thon: Waveform thumbnails for audio files #1298

Open
kayakr opened this issue Oct 11, 2019 · 2 comments
Open

Use-a-Thon: Waveform thumbnails for audio files #1298

kayakr opened this issue Oct 11, 2019 · 2 comments
Labels
Subject: Ansible Playbook Related to the maintenance and upkeep associated with an Ansible Playbook for Islandora. Always also Subject: Drupal related specifically to Drupal, usually pointing somewhere on drupal.org

Comments

@kayakr
Copy link
Contributor

kayakr commented Oct 11, 2019

As a designer I want to see distinct thumbnails for each audio file so I can distinguish repository items at a glance (not so easy if they all have a default thumbnail, see screenshot).
audio-png-thumbnails-before-after

This can be achieved by:

Notes:

  • Uses the FFmpeg showwavespic filter, see https://ffmpeg.org/ffmpeg-filters.html#toc-showwavespic and https://trac.ffmpeg.org/wiki/Waveform
  • the specific arguments are -filter_complex "aformat=channel_layouts=mono,compand,showwavespic=s=320x120:colors=#ffffff,negate" -frames:v 1.
  • to manually try this from a file in the Islandora 8 VM, after creating a Repository Item with model=Audio, and adding an Audio media file sudo ffmpeg -i http://localhost:8000/_flysystem/fedora/2019-10/demo-audio.mp3 -filter_complex "aformat=channel_layouts=mono,compand,showwavespic=s=320x120:colors=#ffffff,negate" -frames:v 1 /var/www/html/drupal/web/sites/default/files/output.png

Add this action (e.g. via Configuration > Development > Configuration synchronization > Import > Single item, Configuration type = Action:

langcode: en
status: true
dependencies:
  module:
    - islandora_image
id: audio_generate_a_thumbnail_from_an_original_file
label: 'Audio - Generate a thumbnail from an original file'
type: node
plugin: generate_image_derivative
configuration:
  queue: islandora-connector-homarus
  event: 'Generate Derivative'
  source_term_uri: 'http://pcdm.org/use#OriginalFile'
  derivative_term_uri: 'http://pcdm.org/use#ThumbnailImage'
  mimetype: image/png
  args: '-filter_complex "aformat=channel_layouts=mono,compand,showwavespic=s=320x120:colors=#ffffff,negate" -frames:v 1'
  destination_media_type: image
  scheme: public
  path: '[date:custom:Y]-[date:custom:m]/[node:nid]-[term:name].png'
@kayakr
Copy link
Contributor Author

kayakr commented Oct 11, 2019

Work in progress action for generating an animated gif thumbnail for a video file such as the What Changes You instance at https://thisvancouver.vpl.ca/

Works on command line:
sudo ffmpeg -i http://localhost:8000/_flysystem/fedora/2019-10/small.mp4 -ss 3 -t 2 -f gif -loop 0 /var/www/html/drupal/web/sites/default/files/output2.gif
but when run via Homarus the resulting gif doesn't animate...

langcode: en
status: true
dependencies:
  module:
    - islandora_image
id: video_generate_animated_thumbnail_from_an_original_file
label: 'Video - Generate animated thumbnail from an original file'
type: node
plugin: generate_image_derivative
configuration:
  queue: islandora-connector-homarus
  event: 'Generate Derivative'
  source_term_uri: 'http://pcdm.org/use#OriginalFile'
  derivative_term_uri: 'http://pcdm.org/use#ThumbnailImage'
  mimetype: image/gif
  args: '-ss 3 -t 2 -f gif -loop 0'
  destination_media_type: image
  scheme: public
  path: '[date:custom:Y]-[date:custom:m]/[node:nid]-[term:name].gif'

Ideally needs a per-item start time, and duration, so that the most representative moment from the video can be represented in the thumbnail.

@Natkeeran
Copy link
Contributor

Natkeeran commented Dec 18, 2019

@dannylamb

This is a nice feature. It seemed to works (I got a black TN with a waveform). Should we included it in the islandora-playbook build?

@kstapelfeldt kstapelfeldt added Subject: Ansible Playbook Related to the maintenance and upkeep associated with an Ansible Playbook for Islandora. Always also Subject: Drupal related specifically to Drupal, usually pointing somewhere on drupal.org and removed Ansible labels Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Subject: Ansible Playbook Related to the maintenance and upkeep associated with an Ansible Playbook for Islandora. Always also Subject: Drupal related specifically to Drupal, usually pointing somewhere on drupal.org
Projects
Development

No branches or pull requests

3 participants