FFMPEG to trim off last 3 seconds of videosCut video with ffmpeg.Rotating videos with FFmpegFFmpeg converted mp4 file fails to load in QuicktimeCutting the videos based on start and end time using ffmpegBest approach to real time http streaming to HTML5 video clientFFmpeg - How to trim with high precision?ffmpeg is cutting video length incorrectlyHow to trim the video with start & end time in android programmatically?How to cut off 5 seconds after every 28 seconds and loop with ffmpeg?FFmpeg Concatenate multiple videos with crossfadeFFMPEG zoompan filter cut short my video and slowed it down

Why do all the teams that I have worked with always finish a sprint without completion of all the stories?

Sci fi short story, robot city that nags people about health

Impossible darts scores

Fedora boot screen shows both Fedora logo and Lenovo logo. Why and How?

STM Microcontroller burns every time

What's currently blocking the construction of the wall between Mexico and the US?

Trainee keeps missing deadlines for independent learning

What does "play with your toy’s toys" mean?

Does Marvel have an equivalent of the Green Lantern?

How long would it take to cross the Channel in 1890's?

Why did pressing the joystick button spit out keypresses?

Is it possible writing coservation of relativistic energy in this naive way?

How does a blind passenger not die, if driver becomes unconscious

What reason would an alien civilization have for building a Dyson Sphere (or Swarm) if cheap Nuclear fusion is available?

What is the mechanical difference between the Spectator's Create Food and Water action and the Banshee's Undead Nature Trait?

Suggested order for Amazon Prime Doctor Who series

Employer wants to use my work email account after I quit

Can Ogre clerics use Purify Food and Drink on humanoid characters?

How dangerous are set-size assumptions?

If I wouldn't want to read the story, is writing it still a good idea?

How risky is real estate?

Did Karl Marx ever use any example that involved cotton and dollars to illustrate the way capital and surplus value were generated?

If the world have massive single giant world tree can it stop earthquake?

Is a single radon-daughter atom in air a solid?



FFMPEG to trim off last 3 seconds of videos


Cut video with ffmpeg.Rotating videos with FFmpegFFmpeg converted mp4 file fails to load in QuicktimeCutting the videos based on start and end time using ffmpegBest approach to real time http streaming to HTML5 video clientFFmpeg - How to trim with high precision?ffmpeg is cutting video length incorrectlyHow to trim the video with start & end time in android programmatically?How to cut off 5 seconds after every 28 seconds and loop with ffmpeg?FFmpeg Concatenate multiple videos with crossfadeFFMPEG zoompan filter cut short my video and slowed it down






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am trying to trim/cut off the last 3 secs of my videos with FFMPEG but this has really been an headache.



The following code trims but only retains the last 3 seconds.
I don't want to retain the 3 secs, i don't need that, i want to retain the deleted part.



ffmpeg -sseof -3 -i input.mp4 output.mp4



Can someone please help me with the right code?.
I will also like to request a batch code that will auto trim all last 3 secs of videos in my folder.
Thanks for the help.










share|improve this question




























    0















    I am trying to trim/cut off the last 3 secs of my videos with FFMPEG but this has really been an headache.



    The following code trims but only retains the last 3 seconds.
    I don't want to retain the 3 secs, i don't need that, i want to retain the deleted part.



    ffmpeg -sseof -3 -i input.mp4 output.mp4



    Can someone please help me with the right code?.
    I will also like to request a batch code that will auto trim all last 3 secs of videos in my folder.
    Thanks for the help.










    share|improve this question
























      0












      0








      0








      I am trying to trim/cut off the last 3 secs of my videos with FFMPEG but this has really been an headache.



      The following code trims but only retains the last 3 seconds.
      I don't want to retain the 3 secs, i don't need that, i want to retain the deleted part.



      ffmpeg -sseof -3 -i input.mp4 output.mp4



      Can someone please help me with the right code?.
      I will also like to request a batch code that will auto trim all last 3 secs of videos in my folder.
      Thanks for the help.










      share|improve this question














      I am trying to trim/cut off the last 3 secs of my videos with FFMPEG but this has really been an headache.



      The following code trims but only retains the last 3 seconds.
      I don't want to retain the 3 secs, i don't need that, i want to retain the deleted part.



      ffmpeg -sseof -3 -i input.mp4 output.mp4



      Can someone please help me with the right code?.
      I will also like to request a batch code that will auto trim all last 3 secs of videos in my folder.
      Thanks for the help.







      video ffmpeg






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 9:40









      humble5050humble5050

      6




      6






















          2 Answers
          2






          active

          oldest

          votes


















          1














          I don't think ffmpeg allows a "from end" spec for duration. You'll have to detect the video's duration yourself and subtract 3 seconds.



          ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0"


          You can do this in a script. For example in bash:



          dur=$(ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0")
          trim=$((dur - 3))
          ffmpeg -t $trim -i input.mp4 output.mp4





          share|improve this answer























          • Thank you for your response, but unfortunately, i am on a windows PC, can u tell me how to run that on windows PC?

            – humble5050
            Mar 25 at 12:15











          • I'd think Windows batch also allows you to store the output of a command and perform arithmetic. Just replace the $(...) stuff with the appropriate syntax.

            – L. Scott Johnson
            Mar 25 at 12:17











          • (In general, StackOverflow is a question-answering platform, not a code-writing service.)

            – L. Scott Johnson
            Mar 25 at 12:19


















          0















          Cut video with ffmpeg.




          use



          ffmpeg -i input.mp4 -ss 3 -i input.mp4 -c copy -map 1:0 -map 0 -shortest -f nut - | ffmpeg -f nut -i - -map 0 -map -0:0 -c copy out.mp4





          share|improve this answer























          • This is the same as doing ffmpeg -i input.mp4 -ss 3 -c copy output.mp4. However, this removes the tail of the video, but humble5050 wants to keep that part only.

            – llogan
            Mar 26 at 17:07











          • Thanks nico_lab,,,this is exactly what i am looking for...u r awesome

            – humble5050
            Mar 27 at 18:59













          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55334909%2fffmpeg-to-trim-off-last-3-seconds-of-videos%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          I don't think ffmpeg allows a "from end" spec for duration. You'll have to detect the video's duration yourself and subtract 3 seconds.



          ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0"


          You can do this in a script. For example in bash:



          dur=$(ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0")
          trim=$((dur - 3))
          ffmpeg -t $trim -i input.mp4 output.mp4





          share|improve this answer























          • Thank you for your response, but unfortunately, i am on a windows PC, can u tell me how to run that on windows PC?

            – humble5050
            Mar 25 at 12:15











          • I'd think Windows batch also allows you to store the output of a command and perform arithmetic. Just replace the $(...) stuff with the appropriate syntax.

            – L. Scott Johnson
            Mar 25 at 12:17











          • (In general, StackOverflow is a question-answering platform, not a code-writing service.)

            – L. Scott Johnson
            Mar 25 at 12:19















          1














          I don't think ffmpeg allows a "from end" spec for duration. You'll have to detect the video's duration yourself and subtract 3 seconds.



          ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0"


          You can do this in a script. For example in bash:



          dur=$(ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0")
          trim=$((dur - 3))
          ffmpeg -t $trim -i input.mp4 output.mp4





          share|improve this answer























          • Thank you for your response, but unfortunately, i am on a windows PC, can u tell me how to run that on windows PC?

            – humble5050
            Mar 25 at 12:15











          • I'd think Windows batch also allows you to store the output of a command and perform arithmetic. Just replace the $(...) stuff with the appropriate syntax.

            – L. Scott Johnson
            Mar 25 at 12:17











          • (In general, StackOverflow is a question-answering platform, not a code-writing service.)

            – L. Scott Johnson
            Mar 25 at 12:19













          1












          1








          1







          I don't think ffmpeg allows a "from end" spec for duration. You'll have to detect the video's duration yourself and subtract 3 seconds.



          ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0"


          You can do this in a script. For example in bash:



          dur=$(ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0")
          trim=$((dur - 3))
          ffmpeg -t $trim -i input.mp4 output.mp4





          share|improve this answer













          I don't think ffmpeg allows a "from end" spec for duration. You'll have to detect the video's duration yourself and subtract 3 seconds.



          ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0"


          You can do this in a script. For example in bash:



          dur=$(ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0")
          trim=$((dur - 3))
          ffmpeg -t $trim -i input.mp4 output.mp4






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 11:56









          L. Scott JohnsonL. Scott Johnson

          2,0478 silver badges14 bronze badges




          2,0478 silver badges14 bronze badges












          • Thank you for your response, but unfortunately, i am on a windows PC, can u tell me how to run that on windows PC?

            – humble5050
            Mar 25 at 12:15











          • I'd think Windows batch also allows you to store the output of a command and perform arithmetic. Just replace the $(...) stuff with the appropriate syntax.

            – L. Scott Johnson
            Mar 25 at 12:17











          • (In general, StackOverflow is a question-answering platform, not a code-writing service.)

            – L. Scott Johnson
            Mar 25 at 12:19

















          • Thank you for your response, but unfortunately, i am on a windows PC, can u tell me how to run that on windows PC?

            – humble5050
            Mar 25 at 12:15











          • I'd think Windows batch also allows you to store the output of a command and perform arithmetic. Just replace the $(...) stuff with the appropriate syntax.

            – L. Scott Johnson
            Mar 25 at 12:17











          • (In general, StackOverflow is a question-answering platform, not a code-writing service.)

            – L. Scott Johnson
            Mar 25 at 12:19
















          Thank you for your response, but unfortunately, i am on a windows PC, can u tell me how to run that on windows PC?

          – humble5050
          Mar 25 at 12:15





          Thank you for your response, but unfortunately, i am on a windows PC, can u tell me how to run that on windows PC?

          – humble5050
          Mar 25 at 12:15













          I'd think Windows batch also allows you to store the output of a command and perform arithmetic. Just replace the $(...) stuff with the appropriate syntax.

          – L. Scott Johnson
          Mar 25 at 12:17





          I'd think Windows batch also allows you to store the output of a command and perform arithmetic. Just replace the $(...) stuff with the appropriate syntax.

          – L. Scott Johnson
          Mar 25 at 12:17













          (In general, StackOverflow is a question-answering platform, not a code-writing service.)

          – L. Scott Johnson
          Mar 25 at 12:19





          (In general, StackOverflow is a question-answering platform, not a code-writing service.)

          – L. Scott Johnson
          Mar 25 at 12:19













          0















          Cut video with ffmpeg.




          use



          ffmpeg -i input.mp4 -ss 3 -i input.mp4 -c copy -map 1:0 -map 0 -shortest -f nut - | ffmpeg -f nut -i - -map 0 -map -0:0 -c copy out.mp4





          share|improve this answer























          • This is the same as doing ffmpeg -i input.mp4 -ss 3 -c copy output.mp4. However, this removes the tail of the video, but humble5050 wants to keep that part only.

            – llogan
            Mar 26 at 17:07











          • Thanks nico_lab,,,this is exactly what i am looking for...u r awesome

            – humble5050
            Mar 27 at 18:59















          0















          Cut video with ffmpeg.




          use



          ffmpeg -i input.mp4 -ss 3 -i input.mp4 -c copy -map 1:0 -map 0 -shortest -f nut - | ffmpeg -f nut -i - -map 0 -map -0:0 -c copy out.mp4





          share|improve this answer























          • This is the same as doing ffmpeg -i input.mp4 -ss 3 -c copy output.mp4. However, this removes the tail of the video, but humble5050 wants to keep that part only.

            – llogan
            Mar 26 at 17:07











          • Thanks nico_lab,,,this is exactly what i am looking for...u r awesome

            – humble5050
            Mar 27 at 18:59













          0












          0








          0








          Cut video with ffmpeg.




          use



          ffmpeg -i input.mp4 -ss 3 -i input.mp4 -c copy -map 1:0 -map 0 -shortest -f nut - | ffmpeg -f nut -i - -map 0 -map -0:0 -c copy out.mp4





          share|improve this answer














          Cut video with ffmpeg.




          use



          ffmpeg -i input.mp4 -ss 3 -i input.mp4 -c copy -map 1:0 -map 0 -shortest -f nut - | ffmpeg -f nut -i - -map 0 -map -0:0 -c copy out.mp4






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 14:06









          nico_labnico_lab

          5044 silver badges7 bronze badges




          5044 silver badges7 bronze badges












          • This is the same as doing ffmpeg -i input.mp4 -ss 3 -c copy output.mp4. However, this removes the tail of the video, but humble5050 wants to keep that part only.

            – llogan
            Mar 26 at 17:07











          • Thanks nico_lab,,,this is exactly what i am looking for...u r awesome

            – humble5050
            Mar 27 at 18:59

















          • This is the same as doing ffmpeg -i input.mp4 -ss 3 -c copy output.mp4. However, this removes the tail of the video, but humble5050 wants to keep that part only.

            – llogan
            Mar 26 at 17:07











          • Thanks nico_lab,,,this is exactly what i am looking for...u r awesome

            – humble5050
            Mar 27 at 18:59
















          This is the same as doing ffmpeg -i input.mp4 -ss 3 -c copy output.mp4. However, this removes the tail of the video, but humble5050 wants to keep that part only.

          – llogan
          Mar 26 at 17:07





          This is the same as doing ffmpeg -i input.mp4 -ss 3 -c copy output.mp4. However, this removes the tail of the video, but humble5050 wants to keep that part only.

          – llogan
          Mar 26 at 17:07













          Thanks nico_lab,,,this is exactly what i am looking for...u r awesome

          – humble5050
          Mar 27 at 18:59





          Thanks nico_lab,,,this is exactly what i am looking for...u r awesome

          – humble5050
          Mar 27 at 18:59

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55334909%2fffmpeg-to-trim-off-last-3-seconds-of-videos%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript