3

I have two recorded video files with the extension .mts. I need to remove some part of the first, split the second, and then merge the first file with the first (split) part of the second file.

They both have the same characteristics:

Format                                   : MPEG-TS
File size                                : 3.16 GiB
Duration                                 : 1h 39mn
Overall bit rate mode                    : Variable
Overall bit rate                         : 4 527 Kbps

Video
ID                                       : 720 (0x2D0)
Menu ID                                  : 6181 (0x1825)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : 27
Duration                                 : 1h 39mn
Width                                    : 1 440 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : MBAFF

They also contain multiple audio tracks and subtitles.

I want to process them without trans-coding the files, at least be able to remove the beginning etc.

I'm in Linux Mint KDE 17.2.


What I have tried:

Openshot: cannot process without transcoding.

Avidemux: when trying to save it says "This is not MPEG compatible - You cannot use the Copy codec."

0

According to this answer, ffmpeg can be used.

(Below is a simplified answer based on the one linked above.)

  • To keep data after a start point (up to the end):

    ffmpeg -i INPUT -c copy -ss START_TIME -map 0 OUTPUT

  • To keep data between two time points:

    ffmpeg -i INPUT -c copy -ss START_TIME -to END_TIME -map 0 OUTPUT

  • To keep data of a certain duration after a certain point:

    ffmpeg -i INPUT -c copy -ss START_TIME -t DURATION_TIME -map 0 OUTPUT

  • To keep data of a certain duration after beginning:

    ffmpeg -i INPUT -c copy -t DURATION_TIME -map 0 OUTPUT

  • To keep data from beginning up to a time point:

    ffmpeg -i INPUT -c copy -to TIME_POINT -map 0 OUTPUT

TIME may be a number in seconds, or in hh:mm:ss[.xxx]


To join files, create a file called join.txt with the content

file 'path-to-INPUT1'
file 'path-to-INPUT2'
file...etc

then

 ffmpeg -f concat -i join.txt OUTPUT

Or:

To join mpeg files (including transport files)

 ffmpeg -i "concat:INPUT-1|INPUT-2" -c copy -bsf:a aac_adtstoasc OUTPUT

As a GUI solution:

Kadenlive, Pitivi and Openshot cannot cut and save a video without transcoding.

Avidemux prior to 2.6.10 doesn't work ok with this kind of files.

To get Avidemux 2.6.10/latest in Ubuntu,

sudo add-apt-repository ppa:rebuntu16/avidemux+unofficial

sudo apt-get update

sudo apt-get install avidemux2.6-gtk avidemux2.6-qt4

Some more dependencies are needed to make it work:

avidemux3-core-2.6.10-YYMMDD-runtime
avidemux3-plugins-COMMON-2.6.10-YYMMDD-plugins
avidemux3-qt4-2.6.10-YYMMDD-runtime
avidemux3-plugins-QT4-2.6.10-YYMMDD-plugins
avidemux3-cli-2.6.10-YYMMDD-runtime
avidemux3-plugins-CLI-2.6.10-YYMMDD-plugins
avidemux3-settings-2.6.10--YYMMDD-settings

see more details in THIS answer.

I have also tested Avidemux-qt4 2.6 in Manjaro, it can be found in AUR.

Also, latest Avidemux for win32 works installed in Wine, as indicated here:

http://avidemux.org/nightly/win32/ enter image description here

To join files, use File-Open to add first file, and then File-Append for the rest.

To save: File - Save.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy