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 · 1 comment

Comments

@kayakr
Copy link
Contributor

@kayakr 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:

  • changing Homarus config to allow PNG thumbnails (see Islandora/Crayfish#78).
  • adding an action that uses Homarus to generate a PNG thumbnail from an audio file.

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

This comment has been minimized.

Copy link
Contributor Author

@kayakr 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.