Skip to content

Commit 92bc0b0

Browse files
authored
Merge pull request #142 from heyakyra/yuv422p-instructions
Add instructions for 10-bit 4:2:2 downsampling to 8-bit 4:2:0 to avoid severe distortion
2 parents 6686ba8 + 15c787a commit 92bc0b0

File tree

1 file changed

+43
-31
lines changed

1 file changed

+43
-31
lines changed

README.md

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,31 @@ A video acquired using a hand-held camera or a camera mounted on a vehicle, typi
2323
* Single pass filter for streaming applications(only with Transcode).
2424
* Virtual-tripod-mode to get a tripod experience.
2525

26-
**NOTE:** This readme focuses mainly on using vidstab with Ffmpeg. See
26+
**NOTE:** This readme focuses mainly on using vidstab with Ffmpeg. See
2727
[here](http://public.hronopik.de/vid.stab) for information regarding installation, usage and examples for using vidstab with Transcode. Or contact me at georg dot martius @ web dot de
28-
28+
2929
## System Requirements
3030
* A Linux-based system
3131
* ffmpeg source code
3232
* Cmake
33-
33+
3434
## Installation Instructions
3535

3636
For using vidstab library with ffmpeg, ffmpeg must to be configured using `--enable-libvidstab ` option.
3737

3838
### Default Build and Installation:
3939
##### Installing vidstab library:
40-
41-
```shell
40+
41+
```shell
4242
cd path/to/vid.stab/dir/
4343
cmake .
4444
make
4545
sudo make install
4646
```
4747

48-
##### Installing ffmpeg:
49-
50-
```shell
48+
##### Installing ffmpeg:
49+
50+
```shell
5151
cd path/to/ffmpeg/dir/
5252
./configure --enable-gpl --enable-libvidstab <other configure options>
5353
make
@@ -72,25 +72,27 @@ PKG_CONFIG_PATH="path/to/install_dir/lib/pkgconfig" \
7272
./configure --enable-gpl --enable-libvidstab <other optionalconfigure options>
7373
make
7474
sudo make install
75-
```
76-
75+
```
76+
7777
Before running ffmpeg for the first time, make sure to export `LD_LIBRARY_PATH` to point to vidstab library, e.g.,
78-
79-
```shell
78+
79+
```shell
8080
export LD_LIBRARY_PATH=path/to/install_dir/lib:$LD_LIBRARY_PATH
81-
```
81+
```
8282

8383
## Usage instructions
8484

85-
**Currently with ffmpeg, vidstab library must run in two-pass mode.** The first pass employs the **vidstabdetect** filter and the second pass uses the **vidstabtransform** filter.
85+
**Currently with ffmpeg, vidstab library must run in two-pass mode.** The first pass employs the **vidstabdetect** filter and the second pass uses the **vidstabtransform** filter.
8686

87-
*Single pass filter with vidstab library is only available with Transcode. The
87+
*Single pass filter with vidstab library is only available with Transcode. The
8888
[deshake](http://www.ffmpeg.org/ffmpeg-filters.html#deshake) filter of ffmpeg can be used for a single-pass encoding, though using the vidstab two-pass filters will give superior results.*
8989

9090
The vidstabdetect filter (in first pass) will generate a file with relative-translation and rotation-transform information about subsequent frames. This information will then be read by vidstabtransform filter (in second pass) to compensate for the jerky motions and produce a stable video output.
9191

9292
Make sure that you use [unsharp](http://www.ffmpeg.org/ffmpeg-filters.html#unsharp-1) filter provided by ffmpeg for best results (only in second pass).
9393

94+
NOTE: 10-bit 4:2:2 video must be downsampled to 8-bit 4:2:0 to avoid distortions like chroma shift or color bleed/smearing (see `format=yuv420p` example below).
95+
9496
*See [the list of ffmpeg filters](http://www.ffmpeg.org/ffmpeg-filters.html) to know more about vidstabdetect, vidstabtransform and all other filters available with ffmpeg.*
9597

9698
### Available options with vidstab filters:
@@ -115,32 +117,37 @@ Make sure that you use [unsharp](http://www.ffmpeg.org/ffmpeg-filters.html#unsha
115117
<dd>Show fields and transforms in the resulting frames for visual analysis. It accepts an integer in the range 0-2. Default value is 0, which disables any visualization.</dd>
116118
</dl>
117119

118-
120+
119121

120122
##### Examples:
121123
Use default values:
122124
```shell
123125
ffmpeg -i input.mp4 -vf vidstabdetect -f null -
124-
```
125-
126+
```
127+
126128
*` -f null - ` makes sure that no output is produced as this is just the first pass. This in-turn results in faster speed.*
127-
129+
128130
Analyzing strongly shaky video and putting the results in file `mytransforms.trf`:
129131
```shell
130132
ffmpeg -i input.mp4 -vf vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf" -f null -
131133
```
132-
134+
133135
Visualizing the result of internal transformations in the resulting video:
134136
```shell
135137
ffmpeg -i input.mp4 -vf vidstabdetect=show=1 dummy_output.mp4
136138
```
137139

138-
Analyzing a video with medium shakiness:
140+
Analyzing a video with high shakiness:
141+
```shell
142+
ffmpeg -i input.mp4 -vf vidstabdetect=shakiness=10 dummy_output.mp4
143+
```
144+
145+
Downsampling a 10-bit 4:2:2 file to 8-bit 4:2:0 to avoid distortion like chroma shift and color bleed/smearing:
139146
```shell
140-
ffmpeg -i input.mp4 -vf vidstabdetect=shakiness=5:show=1 dummy_output.mp4
141-
```
142-
143-
##### Second pass (vidstabtransform filter):
147+
ffmpeg -i input.mp4 -vf format=yuv420p,vidstabdetect -f null -
148+
```
149+
150+
##### Second pass (vidstabtransform filter):
144151
<dl>
145152
<dt><b>input</b></dt>
146153
<dd>Set path to the file used to read the transforms. Default value is <b>transforms.trf</b>.</dd>
@@ -183,12 +190,12 @@ ffmpeg -i input.mp4 -vf vidstabdetect=shakiness=5:show=1 dummy_output.mp4
183190
<br>NOTE: If this mode has been used in first pass then only it should be used in second pass.</dd>
184191
<dt><b>debug</b></dt>
185192
<dd>Increase log verbosity if set to 1. Also the detected global motions are written to the temporary file <b>global_motions.trf</b> . Default value is 0. </dd>
186-
187-
</dl>
188-
193+
194+
</dl>
195+
189196
##### Examples:
190197
Using default values:
191-
```shell
198+
```shell
192199
ffmpeg -i input.mp4 -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 out_stabilized.mp4
193200
```
194201
Note the use of the ffmpeg's unsharp filter which is always recommended.
@@ -203,6 +210,12 @@ Smoothening the video even more:
203210
```shell
204211
ffmpeg -i input.mp4 -vf vidstabtransform=smoothing=30:input="mytransforms.trf" out_stabilized.mp4
205212
```
213+
214+
Downsampling a 10-bit 4:2:2 file to 8-bit 4:2:0 to avoid distortion like chroma shift and color bleed/smearing:
215+
```shell
216+
ffmpeg -i input.mp4 -vf format=yuv420p,vidstabtransform out_stabilized.mp4
217+
```
218+
206219
## Developement/Contributing
207220

208221
Vidstab is an open source library - pull requests are very welcome. Some things you might like to help us out with:
@@ -213,8 +226,7 @@ Vidstab is an open source library - pull requests are very welcome. Some things
213226
* Bugs/fixes.
214227
* New features and improvements.
215228
* Documentation.
216-
217-
229+
218230
## License
219231

220232
See [LICENSE](./LICENSE).

0 commit comments

Comments
 (0)