Harry Developer
Harry Developer

Reputation: 512

ffmpeg set timecode offset in output

I'm trying to create a .ts-file with a timecode starting at a specific offset. Lets say an input file input.ts exists. Running ffprobe on it says "start: 8636.xxx". Now, I like to create a copy with an additional start time offset, using:

ffmpeg -i input.ts -someoption output.ts

The options known to me for manipulating the time, like -copyts -ss -timecode

won't work. Is there an option which allows me to add an extra time offset to the video stream?

Edit:

Here is the ffprobe output of the original ts file:

Duration: 00:06:03.52, start: 6204.163600, bitrate: 3880 kb/s
  Program 12103
    Metadata:
      service_name    : ?ProSieben
      service_provider: ?Unitymedia
    Stream #0:0[0x21f]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x220](ger): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:2[0x222](ger): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 384 kb/s
  No Program
    Stream #0:3[0x224]: Subtitle: dvb_teletext
Unsupported codec with id 94215 for input stream 3

And here is the ffprobe output of the newly created file after running ffmpeg -i input.ts -copyts -output_ts_offset 2428.6 output.ts:

Duration: 00:06:03.36, start: 8634.319544, bitrate: 4372 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, progressive), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101](ger): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 384 kb/s

I'm don't know much about the stream format itself. However, I can see, that the newly created output file contains a lesser number of streams and that some details have changed, like "tv, progessiv" instead of "tv, top first".

I'd like to have an exact copy of the original, except having other time stamps. Is that possible?

Upvotes: 1

Views: 11841

Answers (2)

Sheikh Abdul Wahid
Sheikh Abdul Wahid

Reputation: 2773

I needed to set my own provided start time for output.ts file. I just removed coptyts option.

ffmpeg -i input.ts -muxdelay 0 -muxpreload 0 -output_ts_offset 5 output.ts

Updated

But with above command, hls stream was not working. So I used following command.

ffmpeg -i input.ts -muxdelay 0 -c:v copy -c:a copy -muxpreload 0 -output_ts_offset 5 output.ts

Dont used combined parameter for audio and video codec -c:av copy. It is not working as expected. So use -c:v copy -c:a copy instead.

Upvotes: 1

Gyan
Gyan

Reputation: 92928

Use

ffmpeg -i input.ts -copyts -output_ts_offset 5 output.ts

Since FFmpeg will add, by default 1.4s to start time, the argument above should have 1.4s subtracted, so 3.6.

Or you can just use

ffmpeg -i input.ts -copyts -muxdelay 0 -muxpreload 0 -output_ts_offset 5 output.ts

to apply a 5 second offset.

Upvotes: 4

Related Questions