Code Monkey home page Code Monkey logo

vtt-editor's Introduction

VTT-Editor

Use VTT files to edit film. Using MELT, ffmpeg and co.

Requirements

  • mltframework
  • ffmpeg from GIT (compiled with libfaac & libx264)
  • mplayer (cuz its a reliable way to get framerate)
  • node.js
  • posix shell
  • detox

Install

For Mac Users:

brew install mlt detox mplayer

For Linux Users:

apt-get update && apt-get install mlt detox mplayer

Then:

git clone [email protected]:denjello/VTT-Editor.git
cd VTT-Editor
npm install

At the moment there are two main services:

MASHUP A FOLDER

Example: ./mashup_folder.js -i="/home/user/videos/" -o="test.mp4

Options:
  -i, --inputfolder   input folder with trailing slash                [required]
  -o, --outputfile    output file with mime suffix                    [required]
  -v, --verbose       Use -v=true for extra info                [default: false]
  -y, --system        Use --system=osx if on mac              [default: "linux"]
  -s, --sensitivity   sensitivity of scene detection greater than zero and less
                      than one                                    [default: 0.1]
  -n, --framemin      Min number of frames per scene. Scenes with less than this
                      number of frames will be ignored. It defaults to detected
                      frames per second (fps).                      [default: 1]
  -x, --framemax      Max number of frames per scene as a positive whole number
                      , greater than or equal to framemin. If the scene has more
                      frames than framemax, it will be cut at this number of
                      frames. It defaults to frames per second (fps).
                                                                    [default: 1]
  -r, --randomorder   If set to true will randomly slice and dice the file(s)
                      and put them into your output fuile       [default: false]
  -l, --randomlength  If set to true, it will choose a length between the
                      framemin and framemax, but always lower than the
                      scenelength                               [default: false]
  -b, --batch         If used it will not transcode, but rather return an
                      edl.                                      [default: false]


Here is another example that cuts up all of the video files in the folder ~/Videos with a relatively high accuracy of 0.01 (to scene changes) with a minimum cut length of 5 frames and a maximum cut length of 15 frames, random with verbose output:

$ ./mashup_folder.js --inputfolder='~/Videos' --outputfile='test.mp4' --sensitivity=0.01 --framemin=5 --framemax=15 --randomorder=true --randomlength=true --verbose=true

DROP BORING PARTS OF ONE FILE

Example: ./edl_dropboring.js -i="/home/user/videos/demo.mp4" -o="test.mp4"

Options:
  -i, --inputfile     input file                                      [required]
  -o, --outputfile    output file with mime suffix                    [required]
  -v, --verbose       Use -v for extra info                     [default: false]
  -y, --system        Use --system=osx if on mac              [default: "linux"]
  -s, --sensitivity   sensitivity of scene detection greater than zero and less
                      than one]                                   [default: 0.1]
  -n, --framemin      Min number of frames per scene. Scenes with less than this
                      number of frames will be ignored. It defaults to detected
                      frames per second (fps).                      [default: 1]
  -x, --framemax      Max number of frames per scene as a positive whole number
                      , greater than or equal to framemin. If the scene has more
                      frames than framemax, it will be cut at this number of
                      frames. It defaults to frames per second (fps).
                                                                    [default: 1]
  -r, --randomorder   If set to true will randomly slice and dice the file(s)
                      and put them into your output fuile       [default: false]
  -l, --randomlength  If set to true, it will choose a length between the
                      framemin and framemax, but always lower than the
                      scenelength                               [default: false]
  -b, --batch         If available it will not transcode, but rather return an
                      edl.                                      [default: false]

Roadmap

  • Integrate yargs for command line parsing
  • Detox Filenames to make them safe crossplatform (submodule → detox.js)
  • Rewrite detox.js to be node native and not require detox
  • Determine file framerate (mplayer -identify)
  • Drop requirement for mplayer and recycle ffprobe call
  • Drop file dependency
  • Autogenerate scene-cuts based on visual frame difference over time (ffprobe)
  • Read files line-by-line into node (submodule → liner.js)
  • Remove boring scenes from any video (edl_dropboring.js)
  • Randomize non-boring parts of a single film (edl_dropboring_random.js)
  • Randomly mashup all non-boring scenes of video files in a single folder.
  • Add iteration count to make longer videos
  • Add target settings to melt command (height, width, codec etc.)
  • Use a VTT file as a source
  • Use a
  • Integrate sphinx4 to make word-based subtitles with exact time-code.
  • Use an English sentence as a source based on Sphinx4's mapping.
  • Integrate openCV to do face-tracking and recenter the output
  • Integrate frie0r filter chains
  • Realtime video stream

vtt-editor's People

Contributors

denjello avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nothingismagick

vtt-editor's Issues

Media Type

Just noticed that some older videos report the wrong media type - or at least this is once more a problem of the file programme.

Refactor analyze.sh

  • Write Melt-type frame number into the ${movie}.edl instead of ffmpeg-type timecode.
  • Allow a range to the select scene
    • Current select code example: select=gt(scene\,0.01)
    • Range code example: select=between(scene\,0.01\,0.05)
  • Allow for a prepass to figure out where the mean and outliers are...

osx problem or wrong usage?

the mashup folder script writes an edl for each file but just writes one line each with 25.000 into those.

with verbose i get this output (no output mp4 file is written):

unknown60F81DB21D5E:VTT-Editor anton$ ./mashup_folder.js -i=/Volumes/GHOSTSHARK/mash/ -o=/Volumes/GHOSTSHARK/mash.mp4 --system=osx -v=true
OPTIONS:-n=1 -x=1 -s=0.1 -y=osx -v=true -b=true 
file -b -k --mime-type  '/Volumes/GHOSTSHARK/mash/.DS_Store' | cut -d'/' -f1
file -b -k --mime-type  '/Volumes/GHOSTSHARK/mash/Decoder.avi' | cut -d'/' -f1
[detox.js] /Volumes/GHOSTSHARK/mash/Decoder.avi → safe
file -b -k --mime-type  '/Volumes/GHOSTSHARK/mash/House-Hausu-1977_720p_BRRip_x264_AAC-BeLLBoY-Kingdom-Release-.mp4' | cut -d'/' -f1
[detox.js] /Volumes/GHOSTSHARK/mash/House-Hausu-1977_720p_BRRip_x264_AAC-BeLLBoY-Kingdom-Release-.mp4 → safe
file -b -k --mime-type  '/Volumes/GHOSTSHARK/mash/Stan_Brakhage-Dog_Star_Man-1961-64,_Dvd-.avi' | cut -d'/' -f1
[detox.js] /Volumes/GHOSTSHARK/mash/Stan_Brakhage-Dog_Star_Man-1961-64,_Dvd-.avi → safe
file -b -k --mime-type  '/Volumes/GHOSTSHARK/mash/undefined' | cut -d'/' -f1
./edl_dropboring.js -i='/Volumes/GHOSTSHARK/mash/Decoder.avi' -o='/tmp/VTT-0' -n=1 -x=1 -s=0.1 -y=osx -v=true -b=true 
./edl_dropboring.js -i='/Volumes/GHOSTSHARK/mash/House-Hausu-1977_720p_BRRip_x264_AAC-BeLLBoY-Kingdom-Release-.mp4' -o='/tmp/VTT-1' -n=1 -x=1 -s=0.1 -y=osx -v=true -b=true 
./edl_dropboring.js -i='/Volumes/GHOSTSHARK/mash/Stan_Brakhage-Dog_Star_Man-1961-64,_Dvd-.avi' -o='/tmp/VTT-2' -n=1 -x=1 -s=0.1 -y=osx -v=true -b=true 
GLOBAL:  []
edlFinal: 
melt:

Analyze Image Qualities with Signalstats

I think it would be helpful to compare the YUV Median values for a start ...

e.g.

ffprobe -f lavfi movie=HDV_0537.MP4,signalstats='stat=tout+vrep+brng' -show_frames

RESULTS

[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=469200
pkt_pts_time=15.640000
pkt_dts=469200
pkt_dts_time=15.640000
best_effort_timestamp=469200
best_effort_timestamp_time=15.640000
pkt_duration=1200
pkt_duration_time=0.040000
pkt_pos=28812600
pkt_size=3110400
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=1:1
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
TAG:lavfi.signalstats.YMIN=9
TAG:lavfi.signalstats.YLOW=18
TAG:lavfi.signalstats.YAVG=63.1515
TAG:lavfi.signalstats.YHIGH=166
TAG:lavfi.signalstats.YMAX=255
TAG:lavfi.signalstats.UMIN=95
TAG:lavfi.signalstats.ULOW=113
TAG:lavfi.signalstats.UAVG=123.468
TAG:lavfi.signalstats.UHIGH=130
TAG:lavfi.signalstats.UMAX=170
TAG:lavfi.signalstats.VMIN=103
TAG:lavfi.signalstats.VLOW=126
TAG:lavfi.signalstats.VAVG=135.658
TAG:lavfi.signalstats.VHIGH=152
TAG:lavfi.signalstats.VMAX=191
TAG:lavfi.signalstats.SATMIN=0
TAG:lavfi.signalstats.SATLOW=1
TAG:lavfi.signalstats.SATAVG=10.6546
TAG:lavfi.signalstats.SATHIGH=28
TAG:lavfi.signalstats.SATMAX=65
TAG:lavfi.signalstats.HUEMED=149
TAG:lavfi.signalstats.HUEAVG=149.232
TAG:lavfi.signalstats.YDIF=1.88121
TAG:lavfi.signalstats.UDIF=2.75276
TAG:lavfi.signalstats.VDIF=2.69061
TAG:lavfi.signalstats.TOUT=1.10918e-05
TAG:lavfi.signalstats.VREP=0
TAG:lavfi.signalstats.BRNG=0.00272473
[/FRAME]

According to the ffmpeg manual these are the definitions:

YMIN: Display the minimal Y value contained within the input frame. Expressed in range of [0-255].

YLOW: Display the Y value at the 10% percentile within the input frame. Expressed in range of [0-255].

YAVG: Display the average Y value within the input frame. Expressed in range of [0-255].

YHIGH: Display the Y value at the 90% percentile within the input frame. Expressed in range of [0-255].

YMAX: Display the maximum Y value contained within the input frame. Expressed in range of [0-255].

UMIN: Display the minimal U value contained within the input frame. Expressed in range of [0-255].

ULOW: Display the U value at the 10% percentile within the input frame. Expressed in range of [0-255].

UAVG: Display the average U value within the input frame. Expressed in range of [0-255].

UHIGH: Display the U value at the 90% percentile within the input frame. Expressed in range of [0-255].

UMAX: Display the maximum U value contained within the input frame. Expressed in range of [0-255].

VMIN: Display the minimal V value contained within the input frame. Expressed in range of [0-255].

VLOW: Display the V value at the 10% percentile within the input frame. Expressed in range of [0-255].

VAVG: Display the average V value within the input frame. Expressed in range of [0-255].

VHIGH: Display the V value at the 90% percentile within the input frame. Expressed in range of [0-255].

VMAX: Display the maximum V value contained within the input frame. Expressed in range of [0-255].

SATMIN: Display the minimal saturation value contained within the input frame. Expressed in range of [0-~181.02].

SATLOW: Display the saturation value at the 10% percentile within the input frame. Expressed in range of [0-~181.02].

SATAVG: Display the average saturation value within the input frame. Expressed in range of [0-~181.02].

SATHIGH: Display the saturation value at the 90% percentile within the input frame. Expressed in range of [0-~181.02].

SATMAX: Display the maximum saturation value contained within the input frame. Expressed in range of [0-~181.02].

HUEMED: Display the median value for hue within the input frame. Expressed in range of [0-360].

HUEAVG: Display the average value for hue within the input frame. Expressed in range of [0-360].

YDIF: Display the average of sample value difference between all values of the Y plane in the current frame and corresponding values of the previous input frame. Expressed in range of [0-255].

UDIF: Display the average of sample value difference between all values of the U plane in the current frame and corresponding values of the previous input frame. Expressed in range of [0-255].

VDIF: Display the average of sample value difference between all values of the V plane in the current frame and corresponding values of the previous input frame. Expressed in range of [0-255].

‘tout’: Identify temporal outliers pixels. A temporal outlier is a pixel unlike the neighboring pixels of the same field. Examples of temporal outliers include the results of video dropouts, head clogs, or tape tracking issues.

‘vrep’: Identify vertical line repetition. Vertical line repetition includes similar rows of pixels within a frame. In born-digital video vertical line repetition is common, but this pattern is uncommon in video digitized from an analog source. When it occurs in video that results from the digitization of an analog source it can indicate concealment from a dropout compensator.

‘brng’: Identify pixels that fall outside of legal broadcast range.

use node path module to concatenate path

currently, if you omit the trailing slash on the input directory, the mashup folder script silently fails. you could avoid this by not combining paths like:

var myPath = inputPath + filename;

but rather

var path = require('path');
var myPath = path.join(inputPath, filename);

E2BIG error on large input files / edl with MANY (+30000) lines

child_process.js:1155
    throw errnoException(err, 'spawn');
          ^
Error: spawn E2BIG
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1155:11)
    at exports.spawn (child_process.js:988:9)
    at Object.exports.execFile (child_process.js:682:15)
    at Object.exports.exec (child_process.js:642:18)
    at Transform.<anonymous> (/home/egal/GIT/VTT-Editor/edl_dropboring.js:200:28)
    at Transform.emit (events.js:104:17)
    at emitReadable_ (_stream_readable.js:424:10)
    at emitReadable (_stream_readable.js:418:7)
    at onEofChunk (_stream_readable.js:401:3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.