<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff --git a/libvideogfx/graphics/fileio/ffmpeg.cc b/libvideogfx/graphics/fileio/ffmpeg.cc
index 42034b6..2beb32c 100644
--- libvideogfx/graphics/fileio/ffmpeg.cc
+++ libvideogfx/graphics/fileio/ffmpeg.cc
@@ -135,17 +135,21 @@ namespace videogfx
 
     // alloc frame storage
 
-    frame = avcodec_alloc_frame();
+    //frame = avcodec_alloc_frame();
+    frame = av_frame_alloc();
     if (frame==NULL)
       return false;
 
-    frameRGB = avcodec_alloc_frame();
+    //frameRGB = avcodec_alloc_frame();
+    frameRGB = av_frame_alloc();
     if (frameRGB==NULL)
       return false;
 
-    int nBytesPerFrame = avpicture_get_size(PIX_FMT_RGB24, codecCtx-&gt;width, codecCtx-&gt;height);
+    //int nBytesPerFrame = avpicture_get_size(PIX_FMT_RGB24, codecCtx-&gt;width, codecCtx-&gt;height);
+    int nBytesPerFrame = avpicture_get_size(AV_PIX_FMT_RGB24, codecCtx-&gt;width, codecCtx-&gt;height);
     buffer = static_cast&lt;uint8_t*&gt;(av_malloc(nBytesPerFrame));
-    avpicture_fill(reinterpret_cast&lt;AVPicture*&gt;(frameRGB), buffer, PIX_FMT_RGB24, codecCtx-&gt;width, codecCtx-&gt;height);
+    //avpicture_fill(reinterpret_cast&lt;AVPicture*&gt;(frameRGB), buffer, PIX_FMT_RGB24, codecCtx-&gt;width, codecCtx-&gt;height);
+    avpicture_fill(reinterpret_cast&lt;AVPicture*&gt;(frameRGB), buffer, AV_PIX_FMT_RGB24, codecCtx-&gt;width, codecCtx-&gt;height);
 
 
     // preload first frame
@@ -239,7 +243,8 @@ namespace videogfx
 
     struct SwsContext* swsContext
       = sws_getContext(codecCtx-&gt;width, codecCtx-&gt;height, codecCtx-&gt;pix_fmt,
-		       codecCtx-&gt;width, codecCtx-&gt;height, PIX_FMT_RGB24, SWS_POINT, NULL, NULL, NULL);
+		       //codecCtx-&gt;width, codecCtx-&gt;height, PIX_FMT_RGB24, SWS_POINT, NULL, NULL, NULL);
+		       codecCtx-&gt;width, codecCtx-&gt;height, AV_PIX_FMT_RGB24, SWS_POINT, NULL, NULL, NULL);
 
     sws_scale(swsContext, frame-&gt;data, frame-&gt;linesize, 0, codecCtx-&gt;height,
 	      frameRGB-&gt;data, frameRGB-&gt;linesize);
--- libvideogfx/graphics/fileio/ffmpeg_writer.cc.orig	2014-01-22 03:07:21.000000000 -0800
+++ libvideogfx/graphics/fileio/ffmpeg_writer.cc	2019-03-12 18:39:46.000000000 -0700
@@ -59,19 +59,23 @@
 #define av_guess_format guess_format
 #endif
 
+#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
+#define FF_MIN_BUFFER_SIZE AV_INPUT_BUFFER_MIN_SIZE
+#define AVFMT_RAWPICTURE 0x0020
+
 #include &lt;unistd.h&gt;
 
 
 namespace videogfx
 {
 
-static AVFrame *allocPicture(enum PixelFormat pix_fmt, int width, int height)
+static AVFrame *allocPicture(enum AVPixelFormat pix_fmt, int width, int height)
 {
     AVFrame *picture;
     uint8_t *picture_buf;
     int size;
 
-    picture = avcodec_alloc_frame();
+    picture = av_frame_alloc();
     if (!picture)
         return NULL;
     size = avpicture_get_size(pix_fmt, width, height);
@@ -174,7 +178,7 @@
   c-&gt;time_base.den = d/g;
   c-&gt;time_base.num = n/g;
   c-&gt;gop_size = 25;
-  c-&gt;pix_fmt = PIX_FMT_YUV420P;
+  c-&gt;pix_fmt = AV_PIX_FMT_YUV420P;
 
   if(oc-&gt;oformat-&gt;flags &amp; AVFMT_GLOBALHEADER)
     c-&gt;flags |= CODEC_FLAG_GLOBAL_HEADER;
@@ -208,8 +212,8 @@
   }
 
   tmp_picture = NULL;
-  if (c-&gt;pix_fmt != PIX_FMT_YUV420P) {
-    tmp_picture = allocPicture(PIX_FMT_YUV420P, c-&gt;width, c-&gt;height);
+  if (c-&gt;pix_fmt != AV_PIX_FMT_YUV420P) {
+    tmp_picture = allocPicture(AV_PIX_FMT_YUV420P, c-&gt;width, c-&gt;height);
     if (!tmp_picture) {
       std::cerr &lt;&lt; "could not allocate picture\n";
       return -1;
@@ -233,7 +237,7 @@
   st-&gt;id = 1;
   AVCodecContext *c;
   c = st-&gt;codec;
-  c-&gt;codec_id = CODEC_ID_MP3; //fmt-&gt;audio_codec;
+  c-&gt;codec_id = AV_CODEC_ID_MP3; //fmt-&gt;audio_codec;
   c-&gt;codec_type = AVMEDIA_TYPE_AUDIO;
   c-&gt;sample_fmt = AV_SAMPLE_FMT_S16;
   c-&gt;bit_rate = bitrate;
@@ -265,7 +269,7 @@
   audio_outbuf_size = FF_MIN_BUFFER_SIZE;
   audio_outbuf = (uint8_t*)av_malloc(audio_outbuf_size);
   audio_input_frame_size = c-&gt;frame_size;
-    
+
   samples = (int16_t*)av_malloc(audio_input_frame_size * 2 * c-&gt;channels);
   nBufferedSamples=0;
 
@@ -309,10 +313,10 @@
 
   c = st-&gt;codec;
 
-  if (c-&gt;pix_fmt != PIX_FMT_YUV420P) {
+  if (c-&gt;pix_fmt != AV_PIX_FMT_YUV420P) {
     if (img_convert_ctx == NULL) {
       img_convert_ctx = sws_getContext(c-&gt;width, c-&gt;height,
-				       PIX_FMT_YUV420P,
+				       AV_PIX_FMT_YUV420P,
 				       c-&gt;width, c-&gt;height,
 				       c-&gt;pix_fmt,
 				       SWS_BICUBIC, NULL, NULL, NULL);
@@ -340,6 +344,9 @@
 
     ret = av_interleaved_write_frame(oc, &amp;pkt);
   } else {
+
+    // TODO: FFMPEG API for avcodec_encode_video2() has changed
+#if 0
     out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture);
     if (out_size &gt; 0) {
       AVPacket pkt;
@@ -357,6 +364,9 @@
     } else {
       ret = 0;
     }
+#else
+    assert(false);
+#endif
   }
   if (ret != 0) {
     std::cerr &lt;&lt; "error writing video\n";
@@ -448,11 +458,13 @@
 
 void FFMPEG_Writer::encodeAudioFrame(const int16* p)
 {
+  // TODO: FFMPEG API for avcodec_encode_audio2() has changed
+#if 0
     AVPacket pkt;
     av_init_packet(&amp;pkt);
 
     AVCodecContext *c = audioStream-&gt;codec;
-    
+
     pkt.size= avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, p);
 
     if (c-&gt;coded_frame &amp;&amp; c-&gt;coded_frame-&gt;pts != AV_NOPTS_VALUE)
@@ -465,6 +477,9 @@
       std::cerr &lt;&lt; "cannot write audio\n";
       assert(false);
     }
+#else
+    assert(false);
+#endif
 }
 
 
@@ -512,7 +527,7 @@
     av_init_packet(&amp;pkt);
 
     c = st-&gt;codec;
-    
+
     bool cont = fillAudio(samples, audio_input_frame_size, c-&gt;channels);
     if (!cont) return false;
 
</pre></body></html>