ffmpeg-cli-wrapper icon indicating copy to clipboard operation
ffmpeg-cli-wrapper copied to clipboard

How can I rewrite pts?

Open AalisaM opened this issue 6 years ago • 2 comments
trafficstars

Hello, I'm new to ffmpeg and I have a silly question. I need to read mp4 video and rewrite frames pts data. Is there any way to achieve it with your lib?

I came with one solution, but it's not good: I may read frames, save it as png and then write a new mp4 from my png with any settings I want. Is there another way, which is more elegant?

AalisaM avatar Apr 11 '19 20:04 AalisaM

This library just wraps the ffmpeg command line. If the command line can do it, then this library can.

There seems to be a few solutions on Google when u search for this problem: https://superuser.com/questions/1159056/ffmpeg-recreate-timestamps-without-reencoding https://gist.github.com/mukunm/5c338a375585c12a3679ccc4d85276d5

Once you find a set of command line args that work for you, I can suggest how to use the library.

bramp avatar Apr 11 '19 21:04 bramp

@bramp , Thank you, I've came to one of your solutions, which is

  • ffmpeg -i source.mp4 -map 0:v -vcodec copy -bsf:v h264_mp4toannexb source-video.h264
  • ffmpeg -fflags +genpts -r 60 -i source-video.h264 -vcodec copy output.mp4

Could you please give me a hint how to use your wrapper for these two commands?

AalisaM avatar Apr 12 '19 13:04 AalisaM