4
4
I am looking also for a Linux solution (in a separate question)
I have two recorded video files with the extension .ts
. 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 transcoding the files, at least be able to remove the beginning etc.
FFMPEG
:
ffmpeg -i source.mts
gives:
Input #0, mpegts, from 'source1.mts':
Duration: 01:40:00.76, start: 2995.511878, bitrate: 4526 kb/s
Program 6181
Stream #0:0[0x46](fra,fra): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Stream #0:1[0x2d0]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:2[0x2da](fra): Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 73 kb/s
Stream #0:3[0x2db](qaa): Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 67 kb/s
Stream #0:4[0x2dc](deu): Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 49 kb/s
Stream #0:5[0x2dd](qad): Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 57 kb/s
I think it is very well doable with ffmpeg
, which is also cross-platform, as a command that I found here to remove a part of one file.
ffmpeg -i InputFile -vcodec copy -acodec copy -ss 00:12:34.567 -t 00:34:56.789 OutputFile
works, excepting the fact that the input has four audio tracks and in this way only the first (Stream #0:2[0x2da](fra)
) audio is taken. What I want is: either all audio, either the third (Stream #0:3[0x2db](qaa)
). How to adjust?
ffmpeg
should therefore work to:
1. Cut off the beginning of the first file (remove first 2 minutes out of 1h40 min file)
2. Split a second (1 hour) file in two parts (after 3.05 minutes)
3. Join (append) to the end of the first file the 3.05 min part obtained from splitting the second file.
What I have tried:
Openshot: cannot process without transcoding.
Avidemux (Linux): when trying to save it says "This is not MPEG compatible - You cannot use the Copy codec."
Avidemux in Windows: audio is out of sync.
All I would add is that given the change in scope of the question[s], I would be wary about leaving your unix.SE question open, as it may be seen as cross-posting, which is frowned on. Its up to you to decide if both need to remain open, and I am making no judgement myself but I suspect others might view it as such. – bertieb – 2015-09-29T12:56:10.843
@bertieb - Although common answers may be provided, my U&L question now stands as a different one, as it asks for a general Linux solution, while this one asks for a FFMPEG solution in Windows. - I have indeed created an answer for Linux based on your answer here, and posted here a simplified version of your answer, adding also a possible GUI solution. – None – 2015-10-01T12:27:23.743