Coder Social home page Coder Social logo

h264_glitcher's Introduction

Live H264 Glitcher

Creates glitch effects in H.264 encoded videos by removing keyframes, combining videos, looping intermediate frames.

Can be controlled via OSC.

demo.mp4

Prepare Videos

Use ffmpeg to convert the videos to a raw h264 stream

ffmpeg -i video.mp4 video.h264

It can also be helpful encode all input videos the same way, otherwise transitions between videos don't work properly. These settings have an effect on the glitch effects look in general and could probably be optimized still. They also have an effect on how likely mpv is to lock up when switching videos.

ffmpeg -i video.mp4 -c:v libx264 -vf format=yuv420p,scale=1920:1080 -qp 30 -x264-params bframes=0:refs=1:g=9999999 video.h264

libx264 options Potentially interesting parameters:

  • bframes=0 Disable B-frames
  • refs=1 allow max 1 reference frames for p-frames
  • g=9999999 No keyframes inbetween

Run glitcher

cargo run --release -- -i videos/* |  mpv --no-correct-pts --fps=1000 --no-cache -

By default the glitcher listens on port 8000 for OSC messages.

OSC messages

  • /fps <float> Set frames per second.
  • /record_loop <bool> Loop recording start when true is sent and stops when false is sent. After recording the loop immediately starts playing.
  • /play_loop <bool> Play previously recorded loop.
  • /pass_iframes <bool> Lets I-frames through, disabling the glitch effect.
  • /video_num <int> Loads the n-th video in the list of videos given to --input.

Ideas

  • Fluid speed control, turntable style
  • Video selection UI with thumbnails, groups of videos
  • Recurse directories as input

Todos

  • Find out why video sometimes stutters when switching

h264_glitcher's People

Contributors

antonxy avatar janisstreib avatar problame avatar

Watchers

James Cloos avatar

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.