Skip to content

Feature request: HTML export #17

Closed

Description

@sheimend

I'd love a feature, similar to the existing CSV export, that saved each detected scene into a formatted HTML document that included the thumbnail frames that get saved out on scene detection change.

The HTML doc would contain a table with the same headers as the CSV currently has. However, there'd be a "Frame Image" column that includes one or more of the JPG frame grabs. Each scene would be represented by a row.

For folks who want to do further analysis (in Excel, for instance), it'd much easier to import an HTML table into Excel than it is to add images to a table without them - although that's also possible with an Excel macro.

You can construct the HTML file in the same section of code that currently builds the CSV, either using an HTML builder (I'm sure Python supports one?) or even just by hand by writing out the table markup.

Anyhow, super awesome piece of code you've got. Totally made my day yesterday!

Activity

  1. self-assigned this
    on Aug 3, 2016
  2. Breakthrough commented on Jan 16, 2017

    @Breakthrough
    Owner

    Hey @sheimend;

    I recently added integrated support for splitting videos to PySceneDetect (via mkvmerge), and will be adding HTML output to the list of features to tackle for the current revision series (v0.4.x). Feel I should mention this because in v0.4 and above the command line option -o defaults to the video output now, not the scene list output (the option is now -co, or --csv-output).

    There's two approaches to implementing this that are reasonable. The first is changing the output option from --csv-output to --scene-list-output (-so), and making the output format selectable (and easy to customize). The second would be to simply add another flag -ho (--html-output) that outputs an HTML file, as well as any images to an img/ folder (if it exists).

    I'm leaning towards the latter implementation, but am open to any suggestions you might have.

  3. Breakthrough commented on Aug 5, 2018

    @Breakthrough
    Owner

    I apologize for the lack of progress on this issue, all my effort has been tied up with development of v0.5 (which is a complete refactor of both the CLI and Python API).

    The integration of this feature should be significantly smoother now that the API has been rewritten for modularity first and foremost. I'm working on a feature to configure the number of output images.

    In the meantime, if anyone has a suggestion for a template or how to format N images per scene, as well as the information about each scene's start/end/duration timecode, frame number, and in seconds, I would greatly appreciate it. I'm not much of an HTML/CSS person, so any help on how to format the output would be appreciated.

  4. quietcoding commented on Dec 13, 2018

    @quietcoding

    Hey @Breakthrough,

    Has this been resolved? I'm a little new to this so if you've already completed the majority of the work here, I'll look for something else?

    Regards,
    Andrew H

  5. Breakthrough commented on Dec 13, 2018

    @Breakthrough
    Owner

    Hi @qazqwezxc;

    There hasn't been any progress on this actually, feel free to have a go at it!

    I'm thinking there should be a new command like export-html or something, which should imply save-images, and functions roughly the same way (saves an HTML file with the same name as the video in the working directory, and an override is allowed like export-html --file "some_dir/my_html_file.html").

    Also the command should reflect the global output directory flag (-o).

    Thoughts? Thanks for your interest.

  6. wjs018 commented on May 29, 2019

    @wjs018
    Collaborator

    @Breakthrough

    I know there is a big refactor going on for v0.6, but I took a crack at this and I have it working in my test environment (code here). I added the export-html command with a couple options. It uses the simpletable repo from here that I forked and added image support to here.

    For the export-html command, I added options as follows:

    • --filename / -f: This specifies the name of the resulting html file
    • --no-images: This flag just outputs the table without the images, allows for use without the save-images command (also allows for use with the python interface)
    • --image-width / -w: Optionally specify the width in pixels of the images in the table
    • --image-height / -h: Optionally specify the height in pixels of the images in the table

    Unless the --no-images flag is set, then the export-html command must come after the save-images command. I have never worked with click before, and I wasn't sure how to make commands imply one another. Also, because of how filepaths work in html, I just set the output html file to be saved in the same directory as the saved images (if save-images is used) or the global output directory otherwise.

    An example command would look something like this:
    scenedetect --input goldeneye.mp4 --output output_folder detect-content save-images export-html -w 200

  7. Breakthrough commented on May 29, 2019

    @Breakthrough
    Owner

    @wjs018 that is awesome! Was that simpletable thing public domain, or is there a license associated with it? I want to clear that part up before accepting that particular part of the code into the repo (also is it available on pip? guessing not as you included the source code...)

    I had a look through your fork though, and everything looks good at a first glance - very pleased with the way you approached the problem. Please feel free to submit a pull request if you would like, I would be happy to review the code and accept it into PySceneDetect for the next release.

    I think including the --no-images flag is fine for now, so long as an error can be reported to the user it's okay to force save-images to come before export-html for now (I'll see if there's a way to accomplish one command imply another, as far as I'm aware though there isn't, so the best you can do is report an error afterwards).

    Thank you so much!

  8. wjs018 commented on May 30, 2019

    @wjs018
    Collaborator

    @Breakthrough It isn't available on pypi, but it is under the MIT license. As for one command invoking other commands, from what I can tell, this is possible in click using context.invoke and/or context.forward (docs), but I haven't really looked into it too much.

    I have submitted the pull request in #104 for review.

  9. Breakthrough commented on May 30, 2019

    @Breakthrough
    Owner

    @wjs018 merged - thank you so much for your contribution, very pleased with the quality of your code as well.

    Will be leaving this issue open until I tackle a few of the outstanding comments I brought up in review, as well as updating the documentation for this feature (thank you for well documenting your code, it makes that part much easier for me!). I also need to make a LICENSE file for the included dependency before closing this issue (thanks for providing the link - sorry I didn't see your link before in the review - feel free to ignore that comment or reference your comment above).

    Please feel free to submit any future pull requests if you have any suggestions or changes for the library, should you want to make any further changes to the implementation.

    Nothing in PySceneDetect will change much in v0.6, I just need to add a concept of sparse vs. dense scene detectors to match SceneStats, and possibly have PySceneDetect allow using SceneStats for detection instead of the internal detectors (I'm planning on having PySceneDetect just call out to SceneStats to generate a statsfile much quicker than PySceneDetect could, then load it back into PySceneDetect and perform the actual analysis of the results as usual, in Python - feel free to comment on #72 if you have any suggestions on this matter).

  10. added this to the v0.5.1 milestone on Jul 13, 2019
  11. Breakthrough commented on Jul 20, 2019

    @Breakthrough
    Owner

    Finalized and cleaned up in 6c4c8d4.

  12. msililia commented on Sep 30, 2019

    @msililia

    Cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions