I have .ts videos with variable frame rate and I would like to modify the frames of the videos and keep the timestamps belonging to the frames. I am using python and experiencing with ffmpeg, but I am open to any solution.
The output of
$ffmpeg -i myvideo.ts -hide_banner
Input #0, mpegts, from 'myvideo.ts': Duration: 00:02:37.84, start: 1.400000, bitrate: 13799 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 3840x1080, 25 fps, 25 tbr, 90k tbn, 50 tbc
What I have tried so far is:
import skvideo.io outpudict = {"-map": "0", "-vcodec": "libx264", "-pix_fmt": "yuv420p", "-f": "mpegts" } videogen = skvideo.io.vreader(args.input_video)
writer = skvideo.io.FFmpegWriter(filename + file_extension, outputdict=outpudict)
for i, frame in enumerate(videogen): # modify the frame writer.writeFrame(frame) writer.close()
But so far I am not able to keep the pts and dts parameters of the frames only the format and encoding.
Note: I have tried to use skvideo.io.FFmpegReader or pass the outputdict parameter also to vreader but the script crashed because of this bug.
Note2: I am checking the pts of the frames with
$ffprobe -hide_banner -show_entries packet=pts,dts myvideo.ts
Thank you for reading through my question, any idea would be appreciated!
-- this bug