Today I wanted to obtain a ts file cut preserving everything, so I tried with this command:
ffmpeg -i "original.ts" -map 0 -c copy -t 00:30:0.0 -threads 1 "cutted.ts"
The resulting file have different minor specs I would like to make matching to the original one.
original.ts
[mpeg2video @ 00000000030df040] Invalid frame dimensions 0x0.
Last message repeated 2 times
[mp3 @ 00000000030e0420] Header missing
[mp3 @ 00000000030df940] Header missing
Last message repeated 1 times
[mpegts @ 00000000030dd500] PES packet size mismatch
Last message repeated 2 times
Input #0, mpegts, from 'original.ts':
Duration: 01:14:46.92, start: 64563.955900, bitrate: 5367 kb/s
Program 1
Stream #0:0[0x201]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 16:15 DAR 4:3], max.
10000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x28b](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
Stream #0:2[0x2b7](001): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, mono, s16p, 64 kb/s
Stream #0:3[0x2b8](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
Stream #0:4[0x241](001): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250
cutted.ts
[mp3 @ 000000000302fa20] Header missing
Last message repeated 1 times
[mp3 @ 00000000030304c0] Header missing
Input #0, mpegts, from 'cutted.ts':
Duration: 00:00:10.08, start: 1.400000, bitrate: 4297 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 16:15 DAR 4:3], max.
10000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
Stream #0:2[0x102](001): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, mono, s16p, 64 kb/s
Stream #0:3[0x103](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
Stream #0:4[0x104](001): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250
Bitrate displayed obviously changes because the subset of media considered have a different length and this is ok.
Start is not kept, being part of a transport stream I would like to keep that exact start time. Here https://ffmpeg.org/pipermail/ffmpeg-user/2013-July/016109.html they talk about reset_timestamps and initial_offset but rather than specifying them i would like them to be copied automatically.
Streams id changes as well as some minor specs inside the parenthesis but i don't know what they are for.
Is also possible obtain an output file without ffmpeg service_name and service_provider metadata ?
PS: Original ts file was created by Terratec Home Cinema.
PPS: My question did not include intentionally the -ss option because that one is supposed to change the start time, however I'm interested also in a solution with -ss that automatically (if possible) offsets the start time with (output start time = input start time + -ss command offset)