Log in

View Full Version : encoding with effects like 'mirror image', 'double fps', 'add grain' etc?


cafevincent
10th September 2017, 10:42
I am curious if there is a way to encode using simple effects like combining source with another video layer containing film grain, scratches and burns. Or encode in mirror image or even reverse order (from end to beginning)? Or doubling the frame rate for smoother motion (half duration). This would be fun for creating smooth timelapse versions of some nature footage.

I'm not sure if these are things to look for in a codec or filter/shader or what or are these maybe features in some editing programs?

Please also mention if mirror image is possible during playback. I can't find such a shader for some reason. I would imagine it would be super popular for watching an old movie again. And I assume reverse playback on-the-fly probably doesn't exist.

cafevincent
5th January 2018, 10:53
bump.

Selur
7th January 2018, 17:19
1. These are definitely things that do not belong in the encoder and thus you should look into a tool which uses the encoder but allows filtering of the source.
2. reverse playback on-the-fly
should be possible with ffplay
ffplay -i inputfile.mp4 -vf reverse -af areverse

cafevincent
9th January 2018, 15:16
well what about changing the framerate when encoding? why doesn't doesn't it change the speed of the video?

cafevincent
25th January 2018, 20:51
I am also looking for ways of upscaling SD material.

Selur
27th January 2018, 12:13
Changing the frame rate doesn't change the frame count so why should the encoding speed change.

Regarding upscaling: should not bei part of the encoder.
Search for 'super resolution' and similar.

cafevincent
27th January 2018, 12:24
well I would imagine that framerate defines what amount of frames is displayed in a second (speed of video). if I encode a 1 minute video that has 30fps and in the encoder change it into 60fps then I should obviously end up with a 30sec video at 60fps should I not?

When the encoder drops me a full 1 minute video with 60fps I'm just super confused about where those extra frames came from and are they repeats of the same frames and also what in the world might be the point of this? unless it's a SVP type of feature.

sneaker_ger
27th January 2018, 12:28
There are different ways to change the frame rate. What you describe is like the AssumeFPS() filter in AviSynth. What Selur describes is more like the ChangeFPS() or ConvertFPS() filters.
http://avisynth.nl/index.php/FPS

Selur
27th January 2018, 13:30
Sneaker is right.
Just changing the frame rate doesn't change the frame count. :)
If you increase the frame count the encoding time goes up, if you decrease the frame count encoding time down.
For the encoder the fps shouldn't really matter (aside from calculating an average bitrate or similar).
So if you use SVP or ffmpegs framerate (https://www.ffmpeg.org/ffmpeg-all.html#framerate), minterpolate (https://www.ffmpeg.org/ffmpeg-all.html#minterpolate) or simple frame repetition you create new frames which increases the frame count thus encoding takes longer.

Motenai Yoda
27th January 2018, 18:13
IIRC there is some quality downgrade for higher fps using CRF based encoding, also aq-motion should consider frame duration too

edit:if they ported crf rate control straight from x264, it should be still somewhere in the code

commit c583687fab832ba7eaf8626048f05ad1f861a855 [revision 1867]
Author: Fiona Glaser <fiona@x264.com>
Date: Thu Dec 23 19:33:01 2010 -0500

VFR/framerate-aware ratecontrol, part 2
MB-tree and qcomp complexity estimation now consider the duration of a frame in their calculations.
This is very important for visual optimizations, as frames that last longer are inherently more important quality-wise.
Improves VFR-aware PSNR as much as 1-2db on extreme test cases, ~0.5db on more ordinary VFR clips (e.g. deduped anime episodes).

WARNING: This change redefines x264's internal quality measurement.
x264 will now scale its quality based on the framerate of the video due to the aforementioned frame duration logic.
That is, --crf X will give lower quality per frame for a 60fps video than for a 30fps one.
This will make --crf closer to constant perceptual quality than previously.
The "center" for this change is 25fps: that is, videos lower than 25fps will go up in quality at the same CRF and videos above will go down.
This choice is completely arbitrary.

Note that to take full advantage of this, x264 must encode your video at the correct framerate, with the correct timestamps.