From 705aca93b9062e73a73e0c40883af8070a0f6d93 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Wed, 28 Jun 2017 18:53:08 -0600 Subject: [PATCH] ffmpeg quicktime fps workaround --- cinelerra-5.1/cinelerra/ffmpeg.C | 12 ++++++++++++ cinelerra-5.1/cinelerra/ffmpeg.h | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 243c4e15..70440b64 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -791,6 +791,11 @@ int FFAudioStream::encode_frame(AVFrame *frame) return FFStream::encode_frame(frame); } +int FFAudioStream::write_packet(FFPacket &pkt) +{ + return FFStream::write_packet(pkt); +} + void FFAudioStream::load_markers() { IndexState *index_state = ffmpeg->file_base->asset->index_state; @@ -921,6 +926,13 @@ int FFVideoStream::encode_frame(AVFrame *frame) return FFStream::encode_frame(frame); } +int FFVideoStream::write_packet(FFPacket &pkt) +{ + if( !(ffmpeg->fmt_ctx->oformat->flags & AVFMT_VARIABLE_FPS) ) + pkt->duration = 1; + return FFStream::write_packet(pkt); +} + AVPixelFormat FFVideoConvert::color_model_to_pix_fmt(int color_model) { switch( color_model ) { diff --git a/cinelerra-5.1/cinelerra/ffmpeg.h b/cinelerra-5.1/cinelerra/ffmpeg.h index 5f3f93f1..34bb7364 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.h +++ b/cinelerra-5.1/cinelerra/ffmpeg.h @@ -80,9 +80,9 @@ public: virtual int encode_activate(); virtual int decode_activate(); + virtual int write_packet(FFPacket &pkt); int read_packet(); int seek(int64_t no, double rate); - int write_packet(FFPacket &pkt); int flush(); int decode(AVFrame *frame); void load_markers(IndexMarks &marks, double rate); @@ -145,6 +145,7 @@ class FFAudioStream : public FFStream { int write(const float *fp, long len); int zero(long len); int write(const double *dp, long len, int ch); + int write_packet(FFPacket &pkt); public: FFAudioStream(FFMPEG *ffmpeg, AVStream *strm, int idx, int fidx); virtual ~FFAudioStream(); @@ -205,6 +206,7 @@ public: }; class FFVideoStream : public FFStream, public FFVideoConvert { + int write_packet(FFPacket &pkt); public: FFVideoStream(FFMPEG *ffmpeg, AVStream *strm, int idx, int fidx); virtual ~FFVideoStream(); -- 2.26.2