ffmpeg

jpeg-LS glitching with FFmpeg

In an older version of FFmpeg it was possible to glitch the image with JPEG-LS codec. Newer versions of FFmpeg don’t work anymore in this way, so one must download an old version and compile it (keep it local) – here 2.0.7 is used.

This script takes a video file as an argument, extracts frames, glitches them, and gathers frames back into a video file.

 

 

timelapse aka speeding up with ffmpeg

These days I’m recording my work in the studio using a timelapse function in my Panasonic TM700 HD camera. So it happened that I forgot to turn on the the function (needs to be turned on everytime you start recording) which usually records one frame every 10 seconds, so I ended up with a “normal” recording and wanted to convert that to what camera usually does. Ffmpeg to the rescue! To do some frame manipulation a video filter “setpts” is what one needs. Gathering knowledge online with help of two pages:

http://blog.grio.com/2012/01/fast-and-slow-motion-video-with-ffmpeg.html
https://trac.ffmpeg.org/wiki/How to speed up / slow down a video

So, supposedly, the right way to change video speed using ffmpeg is by adjusting the “presentation time stamp” (PTS). This adjusts frames’ metadata related to how long each is displayed—exactly what you want.

this is the crucial piece of code that needs to be passed to ffmpeg:

-filter:v "setpts=2.0*PTS"

Or a more practical example using fraction – if original framerate is 25 frames per second I only need evert 250th one:

$ ffmpeg -i INPUTFILE.mkv -filter:v "setpts=(1/250)*PTS" OUTPUTFILE.mkv

My final conversion was from full-HD .mts to 720p .webm and to mp4:

$ ffmpeg -i INPUT.mts -filter:v "setpts=(1/250)*PTS" -s 1280x720 -c:v libvpx -crf 5 -b:v 8M -an OUTPUT.webm
$ ffmpeg -i INPUT.mts -filter:v "setpts=(1/250)*PTS" -s 1280x720 -c:v libx264 -preset slow -crf 10 -an OUTPUT.mp4

Prepare audio for YouTube with avconv

How to create a video file from a single image and audio track using avconv:

Thanks to a question/recipe from SuperUser:
superuser.com/questions/571100/avconv-video-from-single-jpg-and-ogg