Commit 3319679d authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'a1e05b04'

* commit 'a1e05b04':
  lavfi: add trim and atrim filters.

Conflicts:
	Changelog
	doc/filters.texi
	libavfilter/Makefile
	libavfilter/allfilters.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 1cba7fa3 a1e05b04
...@@ -34,6 +34,7 @@ version <next>: ...@@ -34,6 +34,7 @@ version <next>:
- vidstabdetect and vidstabtransform filters for video stabilization using - vidstabdetect and vidstabtransform filters for video stabilization using
the vid.stab library the vid.stab library
- astats filter - astats filter
- trim and atrim filters
version 1.2: version 1.2:
......
...@@ -1335,6 +1335,70 @@ with a negative pts due to encoder delay. ...@@ -1335,6 +1335,70 @@ with a negative pts due to encoder delay.
@end table @end table
@section atrim
Trim the input so that the output contains one continuous subpart of the input.
This filter accepts the following options:
@table @option
@item start
Timestamp (in seconds) of the start of the kept section. I.e. the audio sample
with the timestamp @var{start} will be the first sample in the output.
@item end
Timestamp (in seconds) of the first audio sample that will be dropped. I.e. the
audio sample immediately preceding the one with the timestamp @var{end} will be
the last sample in the output.
@item start_pts
Same as @var{start}, except this option sets the start timestamp in samples
instead of seconds.
@item end_pts
Same as @var{end}, except this option sets the end timestamp in samples instead
of seconds.
@item duration
Maximum duration of the output in seconds.
@item start_sample
Number of the first sample that should be passed to output.
@item end_sample
Number of the first sample that should be dropped.
@end table
Note that the first two sets of the start/end options and the @option{duration}
option look at the frame timestamp, while the _sample options simply count the
samples that pass through the filter. So start/end_pts and start/end_sample will
give different results when the timestamps are wrong, inexact or do not start at
zero. Also note that this filter does not modify the timestamps. If you wish
that the output timestamps start at zero, insert the asetpts filter after the
atrim filter.
If multiple start or end options are set, this filter tries to be greedy and
keep all samples that match at least one of the specified constraints. To keep
only the part that matches all the constraints at once, chain multiple atrim
filters.
The defaults are such that all the input is kept. So it is possible to set e.g.
just the end values to keep everything before the specified time.
Examples:
@itemize
@item
drop everything except the second minute of input
@example
ffmpeg -i INPUT -af atrim=60:120
@end example
@item
keep only the first 1000 samples
@example
ffmpeg -i INPUT -af atrim=end_sample=1000
@end example
@end itemize
@section channelsplit @section channelsplit
Split each channel in input audio stream into a separate output stream. Split each channel in input audio stream into a separate output stream.
...@@ -6278,6 +6342,69 @@ The command above can also be specified as: ...@@ -6278,6 +6342,69 @@ The command above can also be specified as:
transpose=1:portrait transpose=1:portrait
@end example @end example
@section trim
Trim the input so that the output contains one continuous subpart of the input.
This filter accepts the following options:
@table @option
@item start
Timestamp (in seconds) of the start of the kept section. I.e. the frame with the
timestamp @var{start} will be the first frame in the output.
@item end
Timestamp (in seconds) of the first frame that will be dropped. I.e. the frame
immediately preceding the one with the timestamp @var{end} will be the last
frame in the output.
@item start_pts
Same as @var{start}, except this option sets the start timestamp in timebase
units instead of seconds.
@item end_pts
Same as @var{end}, except this option sets the end timestamp in timebase units
instead of seconds.
@item duration
Maximum duration of the output in seconds.
@item start_frame
Number of the first frame that should be passed to output.
@item end_frame
Number of the first frame that should be dropped.
@end table
Note that the first two sets of the start/end options and the @option{duration}
option look at the frame timestamp, while the _frame variants simply count the
frames that pass through the filter. Also note that this filter does not modify
the timestamps. If you wish that the output timestamps start at zero, insert a
setpts filter after the trim filter.
If multiple start or end options are set, this filter tries to be greedy and
keep all the frames that match at least one of the specified constraints. To keep
only the part that matches all the constraints at once, chain multiple trim
filters.
The defaults are such that all the input is kept. So it is possible to set e.g.
just the end values to keep everything before the specified time.
Examples:
@itemize
@item
drop everything except the second minute of input
@example
ffmpeg -i INPUT -vf trim=60:120
@end example
@item
keep only the first second
@example
ffmpeg -i INPUT -vf trim=duration=1
@end example
@end itemize
@section unsharp @section unsharp
Sharpen or blur the input video. Sharpen or blur the input video.
......
...@@ -73,6 +73,7 @@ OBJS-$(CONFIG_ASTATS_FILTER) += af_astats.o ...@@ -73,6 +73,7 @@ OBJS-$(CONFIG_ASTATS_FILTER) += af_astats.o
OBJS-$(CONFIG_ASTREAMSYNC_FILTER) += af_astreamsync.o OBJS-$(CONFIG_ASTREAMSYNC_FILTER) += af_astreamsync.o
OBJS-$(CONFIG_ASYNCTS_FILTER) += af_asyncts.o OBJS-$(CONFIG_ASYNCTS_FILTER) += af_asyncts.o
OBJS-$(CONFIG_ATEMPO_FILTER) += af_atempo.o OBJS-$(CONFIG_ATEMPO_FILTER) += af_atempo.o
OBJS-$(CONFIG_ATRIM_FILTER) += trim.o
OBJS-$(CONFIG_BANDPASS_FILTER) += af_biquads.o OBJS-$(CONFIG_BANDPASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_BANDREJECT_FILTER) += af_biquads.o OBJS-$(CONFIG_BANDREJECT_FILTER) += af_biquads.o
OBJS-$(CONFIG_BASS_FILTER) += af_biquads.o OBJS-$(CONFIG_BASS_FILTER) += af_biquads.o
...@@ -178,6 +179,7 @@ OBJS-$(CONFIG_THUMBNAIL_FILTER) += vf_thumbnail.o ...@@ -178,6 +179,7 @@ OBJS-$(CONFIG_THUMBNAIL_FILTER) += vf_thumbnail.o
OBJS-$(CONFIG_TILE_FILTER) += vf_tile.o OBJS-$(CONFIG_TILE_FILTER) += vf_tile.o
OBJS-$(CONFIG_TINTERLACE_FILTER) += vf_tinterlace.o OBJS-$(CONFIG_TINTERLACE_FILTER) += vf_tinterlace.o
OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o
OBJS-$(CONFIG_TRIM_FILTER) += trim.o
OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o
OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o
OBJS-$(CONFIG_VIDSTABDETECT_FILTER) += vidstabutils.o vf_vidstabdetect.o OBJS-$(CONFIG_VIDSTABDETECT_FILTER) += vidstabutils.o vf_vidstabdetect.o
......
...@@ -71,6 +71,7 @@ void avfilter_register_all(void) ...@@ -71,6 +71,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(ASTREAMSYNC, astreamsync, af); REGISTER_FILTER(ASTREAMSYNC, astreamsync, af);
REGISTER_FILTER(ASYNCTS, asyncts, af); REGISTER_FILTER(ASYNCTS, asyncts, af);
REGISTER_FILTER(ATEMPO, atempo, af); REGISTER_FILTER(ATEMPO, atempo, af);
REGISTER_FILTER(ATRIM, atrim, af);
REGISTER_FILTER(BANDPASS, bandpass, af); REGISTER_FILTER(BANDPASS, bandpass, af);
REGISTER_FILTER(BANDREJECT, bandreject, af); REGISTER_FILTER(BANDREJECT, bandreject, af);
REGISTER_FILTER(BASS, bass, af); REGISTER_FILTER(BASS, bass, af);
...@@ -175,6 +176,7 @@ void avfilter_register_all(void) ...@@ -175,6 +176,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(TILE, tile, vf); REGISTER_FILTER(TILE, tile, vf);
REGISTER_FILTER(TINTERLACE, tinterlace, vf); REGISTER_FILTER(TINTERLACE, tinterlace, vf);
REGISTER_FILTER(TRANSPOSE, transpose, vf); REGISTER_FILTER(TRANSPOSE, transpose, vf);
REGISTER_FILTER(TRIM, trim, vf);
REGISTER_FILTER(UNSHARP, unsharp, vf); REGISTER_FILTER(UNSHARP, unsharp, vf);
REGISTER_FILTER(VFLIP, vflip, vf); REGISTER_FILTER(VFLIP, vflip, vf);
REGISTER_FILTER(VIDSTABDETECT, vidstabdetect, vf); REGISTER_FILTER(VIDSTABDETECT, vidstabdetect, vf);
......
This diff is collapsed.
...@@ -31,6 +31,22 @@ fate-filter-aresample: CMD = pcm -i $(SRC) -af aresample=min_comp=0.001:min_hard ...@@ -31,6 +31,22 @@ fate-filter-aresample: CMD = pcm -i $(SRC) -af aresample=min_comp=0.001:min_hard
fate-filter-aresample: CMP = oneoff fate-filter-aresample: CMP = oneoff
fate-filter-aresample: REF = $(SAMPLES)/nellymoser/nellymoser-discont.pcm fate-filter-aresample: REF = $(SAMPLES)/nellymoser/nellymoser-discont.pcm
FATE_ATRIM += fate-filter-atrim-duration
fate-filter-atrim-duration: CMD = framecrc -i $(SRC) -af atrim=start=0.1:duration=0.01
FATE_ATRIM += fate-filter-atrim-mixed
fate-filter-atrim-mixed: CMD = framecrc -i $(SRC) -af atrim=start=0.05:start_sample=1025:end=0.1:end_sample=4411
FATE_ATRIM += fate-filter-atrim-samples
fate-filter-atrim-samples: CMD = framecrc -i $(SRC) -af atrim=start_sample=26:end_sample=80
FATE_ATRIM += fate-filter-atrim-time
fate-filter-atrim-time: CMD = framecrc -i $(SRC) -af atrim=0.1:0.2
$(FATE_ATRIM): tests/data/asynth-44100-2.wav
$(FATE_ATRIM): SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
FATE_FILTER-$(call FILTERDEMDECENCMUX, ATRIM, WAV, PCM_S16LE, PCM_S16LE, WAV) += $(FATE_ATRIM)
FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHANNELMAP, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-filter-channelmap FATE_AFILTER-$(call FILTERDEMDECENCMUX, CHANNELMAP, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-filter-channelmap
fate-filter-channelmap: SRC = $(TARGET_PATH)/tests/data/asynth-44100-6.wav fate-filter-channelmap: SRC = $(TARGET_PATH)/tests/data/asynth-44100-6.wav
fate-filter-channelmap: tests/data/asynth-44100-6.wav fate-filter-channelmap: tests/data/asynth-44100-6.wav
......
...@@ -73,6 +73,20 @@ fate-filter-telecine: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf telecine ...@@ -73,6 +73,20 @@ fate-filter-telecine: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf telecine
FATE_FILTER_VSYNTH-$(CONFIG_TRANSPOSE_FILTER) += fate-filter-transpose FATE_FILTER_VSYNTH-$(CONFIG_TRANSPOSE_FILTER) += fate-filter-transpose
fate-filter-transpose: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf transpose fate-filter-transpose: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf transpose
FATE_TRIM += fate-filter-trim-duration
fate-filter-trim-duration: CMD = framecrc -i $(SRC) -vf trim=start=0.4:duration=0.05
FATE_TRIM += fate-filter-trim-frame
fate-filter-trim-frame: CMD = framecrc -i $(SRC) -vf trim=start_frame=3:end_frame=10
FATE_TRIM += fate-filter-trim-mixed
fate-filter-trim-mixed: CMD = framecrc -i $(SRC) -vf trim=start=0.2:end=0.4:start_frame=1:end_frame=3
FATE_TRIM += fate-filter-trim-time
fate-filter-trim-time: CMD = framecrc -i $(SRC) -vf trim=0:0.1
FATE_FILTER_VSYNTH-$(CONFIG_TRIM_FILTER) += $(FATE_TRIM)
FATE_FILTER_VSYNTH-$(CONFIG_UNSHARP_FILTER) += fate-filter-unsharp FATE_FILTER_VSYNTH-$(CONFIG_UNSHARP_FILTER) += fate-filter-unsharp
fate-filter-unsharp: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf unsharp=11:11:-1.5:11:11:-1.5 fate-filter-unsharp: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf unsharp=11:11:-1.5:11:11:-1.5
......
#tb 0: 1/44100
0, 4410, 4410, 441, 1764, 0x61e374f7
#tb 0: 1/44100
0, 1025, 1025, 1023, 4092, 0x78560a4c
0, 2048, 2048, 1024, 4096, 0xc477fa99
0, 3072, 3072, 1024, 4096, 0x3bc0f14f
0, 4096, 4096, 315, 1260, 0xe4b26b50
#tb 0: 1/44100
0, 26, 26, 54, 216, 0x6b376c6c
#tb 0: 1/44100
0, 4410, 4410, 710, 2840, 0x658982a3
0, 5120, 5120, 1024, 4096, 0xfd6a0070
0, 6144, 6144, 1024, 4096, 0x0b01f4cf
0, 7168, 7168, 1024, 4096, 0x6716fd93
0, 8192, 8192, 628, 2512, 0xda5ddff8
#tb 0: 1/25
0, 10, 10, 1, 152064, 0xb45c4760
#tb 0: 1/25
0, 3, 3, 1, 152064, 0xceb080b0
0, 4, 4, 1, 152064, 0x473db652
0, 5, 5, 1, 152064, 0x287da8e6
0, 6, 6, 1, 152064, 0x68b47c23
0, 7, 7, 1, 152064, 0xe9028bac
0, 8, 8, 1, 152064, 0x28ff8026
0, 9, 9, 1, 152064, 0x2d7c3915
#tb 0: 1/25
0, 1, 1, 1, 152064, 0x7f5f6551
0, 2, 2, 1, 152064, 0xc566f64a
0, 3, 3, 1, 152064, 0xceb080b0
0, 4, 4, 1, 152064, 0x473db652
0, 5, 5, 1, 152064, 0x287da8e6
0, 6, 6, 1, 152064, 0x68b47c23
0, 7, 7, 1, 152064, 0xe9028bac
0, 8, 8, 1, 152064, 0x28ff8026
0, 9, 9, 1, 152064, 0x2d7c3915
#tb 0: 1/25
0, 0, 0, 1, 152064, 0x6e4f89ef
0, 1, 1, 1, 152064, 0x7f5f6551
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment