[FFmpeg-user] How to drop every Nth frame?

Andrey Aleksandrovich andrey.aleksandrovich at googlemail.com
Mon Sep 23 12:36:25 CEST 2013


I also try:
-filter:v select=mod'(n,372)',crop=in_w-20::11:,scale=320:240
but it's the same

[Parsed_select_0 @ 0x543d35fc90] [Eval @ 0x3bd5b30b370] Missing ')' or
too many args in 'mod(n'
[Parsed_select_0 @ 0x543d35fc90] Error while parsing expression 'mod(n'
[AVFilterGraph @ 0x543d2dfed0] Error initializing filter 'select' with
args 'mod(n'

On 9/23/13, Andrey Aleksandrovich <andrey.aleksandrovich at googlemail.com> wrote:
> The new issue. How to use several filters with "select"?
> $ ffmpeg -y -r 372 -i mark.avi -i pcm.wav -c:v ffvhuff -filter:v
> select=mod'(n\,372)',crop=in_w-20::11:,scale=320:240 -r 371 -c:a copy
> fin.avi
> ffmpeg version 1.2.3 Copyright (c) 2000-2013 the FFmpeg developers
>   built on Sep 21 2013 15:25:21 with gcc 4.6.3 (Gentoo Hardened 4.6.3
> p1.13, pie-0.5.2)
>   configuration: --prefix=/usr --libdir=/usr/lib64
> --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared
> --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++
> --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe -march=native'
> --extra-cflags='-O2 -pipe -march=native' --extra-cxxflags='-O2 -pipe
> -march=native' --disable-static --enable-gpl --enable-postproc
> --enable-avfilter --enable-avresample --disable-stripping
> --enable-version3 --disable-indev=v4l2 --disable-indev=oss
> --disable-indev=jack --disable-outdev=oss --enable-version3
> --enable-bzlib --disable-runtime-cpudetect --disable-debug
> --disable-doc --disable-gnutls --enable-hardcoded-tables
> --enable-iconv --disable-network --disable-openssl --enable-ffplay
> --disable-vaapi --enable-vdpau --enable-zlib --disable-libvo-aacenc
> --enable-libvo-amrwbenc --enable-libmp3lame --disable-libfdk-aac
> --disable-libaacplus --disable-libfaac --enable-libtheora
> --disable-libtwolame --enable-libx264 --enable-libxvid
> --disable-libcdio --disable-libiec61883 --disabl  libavutil      52.
> 18.100 / 52. 18.100
>   libavcodec     54. 92.100 / 54. 92.100
>   libavformat    54. 63.104 / 54. 63.104
>   libavdevice    54.  3.103 / 54.  3.103
>   libavfilter     3. 42.103 /  3. 42.103
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> Input #0, avi, from 'mark.avi':
>   Duration: 01:33:34.40, start: 0.000000, bitrate: 9758 kb/s
>     Stream #0:0: Video: ffvhuff (FFVH / 0x48564646), yuv420p, 320x240,
> 20 tbr, 20 tbn, 20 tbc
> [wav @ 0x5341fc6c50] max_analyze_duration 5000000 reached at 5013333
> microseconds
> Guessed Channel Layout for  Input Stream #1.0 : stereo
> Input #1, wav, from 'pcm.wav':
>   Metadata:
>     encoder         : Lavf54.63.104 (libsndfile-1.0.25)
>   Duration: 01:33:20.07, bitrate: 1536 kb/s
>     Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
> stereo, s16, 1536 kb/s
> [Parsed_crop_1 @ 0x534205df00] [Eval @ 0x3d91e33f940] Undefined
> constant or missing '(' in ''
> Error when evaluating the expression ''
> [Parsed_select_0 @ 0x534204d930] Failed to configure input pad on
> Parsed_crop_1
> Error opening filters!
> $
>
> What's wrong with the syntax?
>
> On 9/21/13, Andrey Aleksandrovich <andrey.aleksandrovich at googlemail.com>
> wrote:
>> Sorry to You, my fault.
>> All is working now.
>>
>> On 9/21/13, Andrey Aleksandrovich <andrey.aleksandrovich at googlemail.com>
>> wrote:
>>> I am sorry but it doesn't cut any frames at all.
>>> ffmpeg -y -i original-5614-frames.avi -filter:v "select='mod(n,24)'"
>>> out.avi
>>>
>>> The original video is 5614 frames and the output video is 5614 ones.
>>> I expect that output must be 5381 frames (I need to cut/drop 233
>>> frames - every 24th from 5614).
>>>
>>> On 9/21/13, Sam Logan <shapableline at gmail.com> wrote:
>>>> On 9/21/13, Andrey Aleksandrovich
>>>> <andrey.aleksandrovich at googlemail.com>
>>>> wrote:
>>>>> oh, thanks, but I can't understand syntax of select filer:
>>>>> Example from manual:
>>>>> # select one frame every 100
>>>>> select='not(mod(n,100))'
>>>>>
>>>>> But how to set - "select 23 frames every 24"?
>>>>
>>>> mod() is the modulus function. So mod(n, 100) returns positive for any
>>>> value of n except for multiples of 100, so Boolean negation of that
>>>> will return false for everything except multiples of 100, thereby
>>>> selecting one frame per hundred. So to select 23 frames per 24, do:
>>>>
>>>> select='mod(n,24)'
>>>> _______________________________________________
>>>> ffmpeg-user mailing list
>>>> ffmpeg-user at ffmpeg.org
>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>
>>>
>>
>


More information about the ffmpeg-user mailing list