3

I have a video of 12 seconds, frame rate is 30 frames per second.

I want to apply fade out effect to video on multiple places, for example from second 3rd to 4th and from second 7th to 8th.

Have a look at this command.

ffmpeg -i video.mp4 -strict experimental -vf fade=type=out:start_frame=91:nb_frames=29  -y final_out.mp4 

Above command adds fade out effect from 3rd to 4th second properly, Now I have fired following command

ffmpeg -i video.mp4 -strict experimental -vf fade=type=out:start_frame=91:nb_frames=29 fade=type=out:start_frame=211:nb_frames=29 -y final_out.mp4
and
ffmpeg -i video.mp4 -strict experimental -vf fade=type=out:start_frame=91:nb_frames=29 -y final_out.mp4 fade=type=out:start_frame=211:nb_frames=29

None of them are working, getting following output

$ ffmpeg -i video.mp4 -strict experimental -vf fade=type=out:start_frame=91:nb_frames=29 fade=type=out:start_frame=211:nb_frames=29 -y final_out.mp4
ffmpeg version N-61041-g52a2138 Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar  2 2014 05:45:04 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.33.100
  Duration: 00:00:15.00, start: 0.000000, bitrate: 172 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 768x576 [SAR 9:8 DAR 3:2], 168 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
[NULL @ 0x28c0760] Unable to find a suitable output format for 'fade=type=out:start_frame=211:nb_frames=29'
fade=type=out:start_frame=211:nb_frames=29: Invalid argument

Information about video is as below

I was following this documentation.

Is there any way to apply fade out effect on multiple time slices ??

Thanks in advance

$ ffmpeg -i video.mp4 
ffmpeg version N-61041-g52a2138 Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar  2 2014 05:45:04 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.33.100
  Duration: 00:00:15.00, start: 0.000000, bitrate: 172 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 768x576 [SAR 9:8 DAR 3:2], 168 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
At least one output file must be specified
2
  • Please include the complete ffmpeg console output instead of just a segment.
    – llogan
    May 20, 2014 at 16:47
  • @LordNeckbeard I have added console output plus information of video as well..
    – gkd
    May 21, 2014 at 5:16

1 Answer 1

3

I don't understand what you mean by "fade out twice" since once you fade out the video is black, but this answer should give you an idea of how to perform two fades on the same input.

All filtering must occur within one filtergraph. This example will use the fade video filter to fade in the first 25 frames, and fade out the last 25 frames of a 1000 frame video:

ffmpeg -i input.mp4 -vf "fade=in:0:25,fade=out:975:25" -acodec copy out.mp4
5
  • requirement is to apply fade out effect at two different times with in video, i.e. from 3rd to 4th second and from 7th to 8th second. but I think command you have given should work, now testing on that.
    – gkd
    May 21, 2014 at 9:27
  • ffmpeg -i video.mp4 -vf "fade=out:91:29, fade=out:221:29" -acodec copy out.mp4 - this command haven't give smile.. :(
    – gkd
    May 21, 2014 at 9:45
  • Btw thanks @LordNeckbeard for taking interest in.
    – gkd
    May 21, 2014 at 9:46
  • @mastkalandar You can not perform two fade outs in a row. The first fade out will cause the rest of the video to be just black video, so the second fade out does nothing since the video is already faded out to black video. You will need to fade in before you can perform a second fade out.
    – llogan
    May 21, 2014 at 18:48
  • correct @LordNeckbeard, I got black screen in video, any way I will try to fix thing by some another way. I mean apply fade out to only 3rd to 4th second and save as temporary video, then to this temp video, apply fade out from 7th to 8th second.. feeling sad bcz it will eat cpu time :( :(
    – gkd
    May 22, 2014 at 4:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .