From: Good Guy Date: Thu, 29 Jun 2017 00:53:08 +0000 (-0600) Subject: ffmpeg quicktime fps workaround X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=705aca93b9062e73a73e0c40883af8070a0f6d93;p=goodguy%2Fhistory.git ffmpeg quicktime fps workaround --- 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();