Results 1 to 4 of 4

Thread: ffmpeg, remove parts of file.

  1. #1
    Join Date
    Jan 2010
    Location
    England
    Beans
    185
    Distro
    Ubuntu

    ffmpeg, remove parts of file.

    i would like to use ffmpeg to cut out sections of a mp4 file. i understand how to do it if it is at the beginning or end of the film using the start time or duration options, how can i cut out a section that is in the middle of the film?

    spiritech
    Keep those cups of Ubuntu comming.
    Ubuntu 12.10

  2. #2
    Join Date
    May 2011
    Beans
    226
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ffmpeg, remove parts of file.

    After doing some searching it seems the way to do this is to extract the beginning and end and then join the files. However, as mentioned here http://stackoverflow.com/questions/7...eo-from-ffmpeg, .mp4 cant be joined with the cat command. Therefore, you need to convert to .mpg during the extraction of the two halves of the video, as .mpg video can be joined with the cat command according to the above link. NOTE: All this was found with a few minutes of searching.

  3. #3
    Join Date
    Sep 2006
    Beans
    3,713

    Re: ffmpeg, remove parts of file.

    Quote Originally Posted by Mr. Shannon View Post
    After doing some searching it seems the way to do this is to extract the beginning and end and then join the files. However, as mentioned here http://stackoverflow.com/questions/7...eo-from-ffmpeg, .mp4 cant be joined with the cat command. Therefore, you need to convert to .mpg during the extraction of the two halves of the video, as .mpg video can be joined with the cat command according to the above link. NOTE: All this was found with a few minutes of searching.
    That StackOverflow answer is outdated. The method of converting to mpeg-2 video and using cat is no longer required now that there is the concat demuxer, protocol, and filter. You can create the segments that you want to join:

    Code:
    ffmpeg -i input.mp4 -ss 10 -t 5 -c copy -map 0 output1.mp4
    ffmpeg -i input.mp4 -ss 120 -t 12 -c copy -map 0 output2.mp4
    And then join them with the concat demuxer as shown in How to concatenate (join, merge) media files.

    I don't think the fake "ffmpeg" from libav in the repo can do this, so you'll have to get a recent real ffmpeg. Static builds are easy to use: example instructions.
    Last edited by FakeOutdoorsman; March 7th, 2013 at 06:28 AM.

  4. #4
    Join Date
    Jan 2010
    Location
    England
    Beans
    185
    Distro
    Ubuntu

    Re: ffmpeg, remove parts of file.

    i will give the concat demuxer a go, seems like the simplest option.
    Keep those cups of Ubuntu comming.
    Ubuntu 12.10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •