Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7014575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:32:19+00:00 2026-05-27T22:32:19+00:00

I have multiple mpeg2 video files. What I need to do is get a

  • 0

I have multiple mpeg2 video files. What I need to do is get a clip of video that is contained in several of these mpeg2 videos. What I’m doing at the moment is:

  • Join them using the command:

        copy /b file1.mpg + ... + fileN.mpg output.mpg
    
  • The ouput.mpg duration is wrong so I’m using FFMpeg to fix that:

        ffmpeg -y -i output.mpeg -target pal-dvd outputFixed.mpg
    

The problem is when I try to extract only one portion of this output.mpg, at the same time I “fix” it, with the -ss and -t FFMpeg commands becouse the video duration is wrong as i said.

So the question is:

  • Is there any way to combine Mpeg2 files without getting the duration wrong?
  • Is there any way to fix the duration of a Mpeg2 file and extract one portion at the same time?

Any suggestion would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:32:20+00:00Added an answer on May 27, 2026 at 10:32 pm

    From the ffmpeg FAQ:

    3.13 How can I join video files?

    A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join
    video files by merely concatenating them.

    Hence you may concatenate your multimedia files by first transcoding
    them to these privileged formats, then using the humble cat command
    (or the equally humble copy under Windows), and finally transcoding
    back to your format of choice.

    ffmpeg -i input1.avi -same_quant intermediate1.mpg ffmpeg -i
    input2.avi -same_quant intermediate2.mpg cat intermediate1.mpg
    intermediate2.mpg > intermediate_all.mpg ffmpeg -i
    intermediate_all.mpg -same_quant output.avi Notice that you should
    either use -same_quant or set a reasonably high bitrate for your
    intermediate and output files, if you want to preserve video quality.

    Also notice that you may avoid the huge intermediate files by taking
    advantage of named pipes, should your platform support it:

    mkfifo intermediate1.mpg mkfifo intermediate2.mpg ffmpeg -i
    input1.avi -same_quant -y intermediate1.mpg < /dev/null & ffmpeg -i
    input2.avi -same_quant -y intermediate2.mpg < /dev/null & cat
    intermediate1.mpg intermediate2.mpg |\ ffmpeg -f mpeg -i – -same_quant
    -c:v mpeg4 -acodec libmp3lame output.avi Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also allow concatenation,
    and the transcoding step is almost lossless. When using multiple
    yuv4mpegpipe(s), the first line needs to be discarded from all but the
    first stream. This can be accomplished by piping through tail as seen
    below. Note that when piping through tail you must use command
    grouping, { ;}, to background properly.

    For example, let’s say we want to join two FLV files into an
    output.flv file:

    mkfifo temp1.a mkfifo temp1.v mkfifo temp2.a mkfifo temp2.v mkfifo
    all.a mkfifo all.v ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le
    -ac 2 -ar 44100 – > temp1.a < /dev/null & ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 – > temp2.a < /dev/null &
    ffmpeg -i input1.flv -an -f yuv4mpegpipe – > temp1.v < /dev/null & {
    ffmpeg -i input2.flv -an -f yuv4mpegpipe – < /dev/null | tail -n +2 >
    temp2.v ; } & cat temp1.a temp2.a > all.a & cat temp1.v temp2.v >
    all.v & ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
    -f yuv4mpegpipe -i all.v \
    -same_quant -y output.flv rm temp[12].[av] all.[av]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple threads (C# application running on IIS) running that all need to
I have three videos: a lecture that was filmed with a video camera a
I have the following scenario: Data from multiple video files needs to be held
I have multiple MVC 3 forms that need form validation on certain fields (mostly
I have multiple classes that all derive from a base class, now some of
I have multiple logos of various companies in various formats that needs to be
I have multiple table rows that has a set of radio buttons on each
I have multiple elements with the same class clickable, i'm binding all these classes
I have multiple css files in a directory (style0.css, style1.css etc..) How can I
I have multiple jquery files in my project. Yesterday googled this problem and find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.