How To: Start And Stop ffmpeg Converting At a Specific Time

Whoaa, Long title there! Anyway, as the title would suggest, I am about to explain to you how to start and stop ffmpeg converting at a specific time. The command variables are very simple -ss (Start time) and -t (Convert as specified amount of time).

Sounds tricky? Don’t worry, i’ll explain it to you in detail. Let’s say for example you have a one hour long video (or audio track) that you want to start twenty minutes after the intro and then continue (used in the format, hours:minutes:seconds)

ffmpeg -i “video/audio.format” -sameq -ss 00:20:00 “output.format”

Very simple right? Ok, let’s imagine you want your video (or audio track) to start as normal but stop after one hour and twenty minutes, then use this command:

ffmpeg -i “video/audio.format” -sameq -t 01:20:00 “output.format”

And thats it! If you like this post and like to learn more about ffmpeg, Click Here to see my other ffmpeg tutorials.

NOTE: I am not responsible for any copyrighted material (ex, music videos) that get’s converted to audio or video using this method.

8 responses to “How To: Start And Stop ffmpeg Converting At a Specific Time”

  1. I am trying to automate recording of a broadcast. If I use -ss option, the recording simply ignore it and starts recording immediately. The -t option doesn’t allow recording to stop. What am I doing wrong?

    Regards; Luka

    • I have noticed slight differences in FFmpeg:s syntax depending on the version, some variable may have worked in a older version and vice versa. I’m not sure about “-ss”, are you using the latest version?

  2. I am using the one build in Fedora 14:
    $ ffmpeg -version
    FFmpeg version SVN-r24044, Copyright (c) 2000-2010 the FFmpeg developers
    built on Jul 21 2010 15:07:15 with gcc 4.5.0 20100716 (Red Hat 4.5.0-3)
    configuration: –prefix=/usr –bindir=/usr/bin –datadir=/usr/share/ffmpeg –incdir=/usr/include/ffmpeg –libdir=/usr/lib –mandir=/usr/share/man –arch=i686 –extra-cflags=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables’ –extra-version=rpmfusion –enable-bzlib –enable-libdc1394 –enable-libdirac –enable-libgsm –enable-libmp3lame –enable-libopenjpeg –enable-librtmp –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-libvpx –enable-libx264 –enable-libxvid –enable-x11grab –enable-avfilter –enable-avfilter-lavf –enable-postproc –enable-pthreads –disable-static –enable-shared –enable-gpl –disable-debug –disable-stripping –shlibdir=/usr/lib –cpu=i686 –enable-runtime-cpudetect
    libavutil 50.20. 0 / 50.20. 0
    libavcodec 52.79. 1 / 52.79. 1
    libavformat 52.73. 0 / 52.73. 0
    libavdevice 52. 2. 0 / 52. 2. 0
    libavfilter 1.20. 1 / 1.20. 1
    libswscale 0.11. 0 / 0.11. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    FFmpeg SVN-r24044
    libavutil 50.20. 0 / 50.20. 0
    libavcodec 52.79. 1 / 52.79. 1
    libavformat 52.73. 0 / 52.73. 0
    libavdevice 52. 2. 0 / 52. 2. 0
    libavfilter 1.20. 1 / 1.20. 1
    libswscale 0.11. 0 / 0.11. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    Is this procedure even apropriate to record only audio from a online stream? Or is it usable only for video cutting/editing? I need to automate recording live stream (audio) and do not have time to record about 10h of stream and than try to cut it. Is there any other easy way that does not require GUI and can be automated?

    • Sorry Luka, I may have misinterpreter what you where saying before. No, I don’t think FFmpeg is capable of what you want to accomplish. I have never used it to automate recordings before, but I do think it is possible, just not with FFmpeg alone. If you really want a non-GUI way of recording, look into some bash scripting on how to redirect output from your stream to FFmpeg. Possibly using the “less than” and “greater than” variables.

      I hope that helps you.

      • i try to follow your intiructson on installation zlibapt-cache search zlib this command doesn’t give any errorbut ..apt-get install zlib-bin zlib1g zlib1g-dev zlibc give this errorE: could not open lock file /var/lib/dpkg/lock open (13 permision denied)E: unable to lock the administration directory (/var/lib/dkpg/), are you root?i really need your help how to solve this problem..i’m using ubuntu9.04

Leave a Reply to Luka Cancel reply

Your email address will not be published. Required fields are marked *