Skip to content

Accessing file metadata using '<attachment>_meta' #42

@jclemans

Description

@jclemans
You may optionally add `<attachment>_meta` to your model and it will get populated with information about the processed video.

What does this mean? Where and how does this need to be added to the model in order to work? There is a lack of context in the documentation on this subject. The way this is written looks like it has something to do with view markup, which seems contradictory to the instructions. I've looked at the source code and searched for any examples utilizing this feature, but can't make heads or tails of it. Can anyone provide additional detail on how to access file metadata using this gem? I really would like to be able to access an mp4 file's duration metadata.

If anyone can answer this question I would be more than happy to update the README to help others using this gem.

Edit: As a workaround I found an ffmpeg command that will grab the video duration from the metadata after it has been uploaded and saved. I set up an after_save callback on my video model that uses this to save the duration to the db.
duration = ffprobe -i #{file_path} -show_entries format=duration -v quiet -of csv="p=0"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions