Author Topic: Remuxing an m2v and mp2 file  (Read 162 times)

BPak

  • Newbie
  • *
  • Posts: 4
Remuxing an m2v and mp2 file
« on: April 03, 2018, 04:36:13 AM »
I have been using version 2-4-4 avidemux for long time and could use ProjectX to clean up and seperate a .ts file ino a seperte Video and Audio file.

I do not see the same options available in version 2-6.

Is there a help file anywhere that can show me how to remux these files with Avidemus 2.6?
« Last Edit: April 03, 2018, 04:41:55 AM by BPak »

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 5865
Re: Remuxing an m2v and mp2 file
« Reply #1 on: April 03, 2018, 10:15:40 AM »
Re-muxing not re-encoding: use [Copy] in  Video and Audio Output
Select appropriate Container Format in Output Format like Mkv Muxer, ...

Mpeg2 (ff) involves re-encoding selectable in Video Output

m2v is not an option
« Last Edit: April 03, 2018, 10:23:32 AM by Jan Gruuthuse »

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1830
Re: Remuxing an m2v and mp2 file
« Reply #2 on: April 03, 2018, 11:21:03 AM »
2.6. is long as EOL, please use the latest nightly as the latest release 2.7.0 is quite outdated too.

Please explain what you are actually trying to do. Avidemux is not ProjectX and thus won't repair partially corrupted MpegPS / MpegTS streams with MPEG-2 video, its purpose is to cut valid streams either losslessly in copy mode or reencoding using a variety of codecs.

If all you have are elementary streams (separate video and audio streams without a container) produces by ProjectX, you have lost, Avidemux doesn't support such streams. You need the original transport stream (.ts) or program stream (.mpg). Maybe ffmpeg is able to do this, try

Code: [Select]
ffmpeg -fflags +genpts -i video.m2v -i audio.mp2 -c copy output.mpg

BPak

  • Newbie
  • *
  • Posts: 4
Re: Remuxing an m2v and mp2 file
« Reply #3 on: April 03, 2018, 09:59:34 PM »
I use TV to capture a show to disc. It saves it usually in a .ts format.
I use ProjectX to run this .ts file through its Demux.
This is said to remove bad frames and separate the Movie to m2v file and the Audio o mp2 file which allows the two files to be rejoined without the errors.
ProjectX also say that it keeps the frames in context with DVD requirements as a TV broadcast does not do this.

I have used the Avidemux 2.4.4 program to join (remux) these two files.
In Avidemux 2.4.4 we select the m2v file and go to the Audio menu option and select mp3 and select the mp2 file.
We then have it set to Copy for both settings and to go into a MPEG PS container and save the combines file.
From there we load this new file into Avidemux and cut it and then convert to AVI container.
Works exceptionally well. but new codexs turn up and we have to really look to Avidemux 2.6.
Hope that explains the process and what we have been using.
Thank you for your help.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1830
Re: Remuxing an m2v and mp2 file
« Reply #4 on: April 03, 2018, 11:17:27 PM »
ProjectX also say that it keeps the frames in context with DVD requirements as a TV broadcast does not do this.

This is mostly impossible without reencoding.

Again, if the m2v file is an elementary stream and not a program stream, you won't be able to load it in Avidemux 2.6 and later. If you don't have the original .ts anynore, try your luck with ffmpeg as mentioned above.

Apart from that, nothing changed, you can still load a video in Avidemux, add an external audio in the "Audio" --> "Select Tracks" menu and mux them together.

Quote
From there we load this new file into Avidemux and cut it and then convert to AVI container.
Works exceptionally well.

AVI is pretty much the worst possible choice.

Quote
but new codexs turn up and we have to really look to Avidemux 2.6.

Avidemux 2.6.x is EOL, it doesn't get any fixes or improvements. There should not be a reason apart from running an outdated operating system like Windows XP to use it instead of 2.7.0 (better the latest nightly).

BPak

  • Newbie
  • *
  • Posts: 4
Re: Remuxing an m2v and mp2 file
« Reply #5 on: April 04, 2018, 04:49:44 AM »
Yes your ffmpeg code did put the m2v and mp2 files back together ok.
They run in VCL and Windows Media Player ok.
However, when opening the mpg file in Avidemux 2.6 the sound is out of sync.
Opening the mpg file in Avidemux 2.4 everything is OK.

Apart from that, nothing changed, you can still load a video in Avidemux, add an external audio in the "Audio" --> "Select Tracks" menu and mux them together.

What file extension can be used for this?

OK - I will get Avidemux 2.7

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1830
Re: Remuxing an m2v and mp2 file
« Reply #6 on: April 04, 2018, 06:43:38 AM »
Yes your ffmpeg code did put the m2v and mp2 files back together ok.
They run in VCL and Windows Media Player ok.
However, when opening the mpg file in Avidemux 2.6 the sound is out of sync.

If the A/V offset remains constant throughout the video, just check the audio shift checkbox and find a value which works best. Avidemux 2.6.x and later versions rely on presentation timestamps (PTS) provided by the container in order to be able to handle modern codecs while earlier versions just counted frames. This is the reason I added -fflags +genpts to the ffmpeg command line. If it does not work right, you might try to omit these options and look how it fares.

If the A-V-delta grows, only the original .ts will help.

Quote
Quote
Apart from that, nothing changed, you can still load a video in Avidemux, add an external audio in the "Audio" --> "Select Tracks" menu and mux them together.

What file extension can be used for this?

I don't think file name extension matters.

Quote
OK - I will get Avidemux 2.7

The latest nightly, please. It has dozens of issues fixed in comparison with Avidemux 2.7.0 release, which is 8 months old. This is pretty much for an actively developed application.

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 5865
Re: Remuxing an m2v and mp2 file
« Reply #7 on: April 04, 2018, 09:45:32 AM »
Don't forget 2.4.4 was a frame based editor, 2.6 onwards avidemux is time based editor, due to the newer codecs.

BPak

  • Newbie
  • *
  • Posts: 4
Re: Remuxing an m2v and mp2 file
« Reply #8 on: April 04, 2018, 09:46:11 PM »
Quote
If the A/V offset remains constant throughout the video, just check the audio shift checkbox and find a value which works best. Avidemux 2.6.x and later versions rely on presentation timestamps (PTS) provided by the container in order to be able to handle modern codecs while earlier versions just counted frames. This is the reason I added -fflags +genpts to the ffmpeg command line. If it does not work right, you might try to omit these options and look how it fares.

If the A-V-delta grows, only the original .ts will help.

-600 worked fine in my first attempt. Was in sync all the way. ProjectX is supposed to make that happen when it demuxes into two files.
Will do more testing on this process. Originally the ts files used to have breakups and resulted in sound async issues and that is why we went to ProjectX.
I will make a small program to run the ffmpeg file (saves all the typing).
I noticed in the documents a section on working on ts files that are corrupted by using other programs.
Quote
Mpeg-TS will be considered perfect, i.e. there will be no correction for dropped or damaged packets. It means that if your captured stream is not perfect you will have async problems. In that case, better to use another tool, such as mencoder or transcode.

If you happen to have a non perfect Mpeg-Ts stream or a mpeg-PES (such as the ones generated by some DVB cards), you can try to use replex to convert them to a proper mpeg PS stream.
Also on research noticed that ffmpeg was favoured over mencoder.

Quote
The latest nightly, please. It has dozens of issues fixed in comparison with Avidemux 2.7.0 release, which is 8 months old. This is pretty much for an actively developed application.

Regarding the new avidemux release 27 March if I remember is the one I installed.

Quote
Don't forget 2.4.4 was a frame based editor, 2.6 onwards avidemux is time based editor, due to the newer codecs.
Did not know this change had happened.!
 Thanks for the info and help!
« Last Edit: April 05, 2018, 09:35:54 PM by BPak »