Usage
Here, i'm trying to sequeeze a normal video to a n times faster. But, i found that there are many ways to relize this, such as
- ffmpeg and adjust the speed while roamming, etc.
- OpenCV requires being complied with ffmpeg, which i didn't have the condition and many video format(.mp4) is not well supported.
Installation
- Under Linux
1 |
|
- Under Windows
Directly download the binary executable file from the official page. Move
to the bin folder and run the ./ffmpeg
in command line.
For example the "ffmpeg-master-latest-win64-gpl-shared" file.
Some common command line arguments
From ffmpeg official page.
-y
: (default) to automatically override the out file without further confirmation.-i
: input file.-vf
: video filter, e.g. v360 et al.-bufsize
: set the buffer size.-c:v libx265
: libx265 video encoder.-b:v 40000k
: setting code rate of video.--preset
: 主要调节编码速度和质量的平衡,有ultrafast(转码速度最快,视频往往也最模糊)、superfast、veryfast、faster、fast、medium、slow、slower、veryslow、placebo,从快到慢.
Video speed acceleration
- Speed or slow down the video, and the example as followings (but the content is not smooth at all): *** 4 times faster:+1:
ffmpeg -i origin.mp4 -vf "setpts=0.25\*PTS" UpTheOrigin.mp4
4 times slower
ffmpeg -i origin.mp4 -vf "setpts=4\*PTS" DownTheOrigin.mp4
- Change the video format
ffmpeg -i origin.ogv -vcodec h264 output.mp4
ffmpeg -i origin.ogv -vcodec mpeg4 output.mp4
ffmpeg -i origin.ogv -vcodec libxvid output.mp4
ffmpeg -i origin.mp4 -vcodec wmv1 output.wmv
ffmpeg -i origin.mp4 -vcodec wmv2 output.wmv
- Compress video into a smaller one.
1 |
|
- More resources
Please dive the Blog.
Attach two images(videos) into one image(video)
1 |
|
-filter_complex hstack: hstack
means images are stacked
horizontally, vertically is set to vstack
.
the raw separate images are here:
left image | right image |
---|---|
the returned joined image (./dual_fisheye_image.png) is as followings:
References
Fisheye Image to equirectangular Image
- For single dual fisheye image to equirectangular image.
1 |
|
185 is the image FOV.
References
- fisheye to equirectangular image (Recommanded:+1::+1::+1:)
- similar as upper for yaw angle setting demonstration.
- here is information-less:-1:.
Sequence image to video back and forth
- image to video
1 |
|
-f: image2
image type.
-r: video frame equal to 1, default by 25, which means extract 1(25)
frames/s. Also known as definition how fast the pictures are read in. To
note that, the position of the -r
argument has different
meanings. If we want to change the framerate of the output video,
-r
should be at the front of the
./fisheye_rgb.mp4
-pix_fmt yuv420p
: is required under Windows
platform.
- video to image
1 |
|
%10d: rename the out put images with int, e.g 0000000001.png.
-start_number 0
: means the result image id will start
from 0. Also this argument could be used for selecting the specific
images for video generation. Deeper operations(e.g. glob, cat and etc)
from reference1.
References
Dual fisheye image video to equirectangular video
- For dual fisheye video to equirectangular video.
1 |
|
here we choose the ==v360== filter, v360 basic
command as followings:
input:output:interp:w:h:in_stereo:out_stereo:yaw(pitch\roll):rorder:h_filp(v_flip\d_flip):ih_flip(iv_flip):in_trans:out_trans:h_offset(\v_offset):alpha_mask:reset_rot
and the corresponding parameters as followings:
dfisheye
= input format is dual fisheye video for
input
.
e
= 'Equirectangular projection' for output
video format.
yaw
= rotation along yaw direction for output video.
Values in degrees.
ih_fov
& iv_fov
= is output
horizontal/vertical/diagonal field of view. Values in degrees.
there are no blending operation for the basic command code.