+diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c
+index 46a91c9..fed455f 100644
+--- a/examples/am7xxx-play.c
++++ b/examples/am7xxx-play.c
+@@ -31,7 +31,6 @@
+
+ #include <libavdevice/avdevice.h>
+ #include <libavformat/avformat.h>
+-#include <libavutil/imgutils.h>
+ #include <libswscale/swscale.h>
+
+ #include <am7xxx.h>
+@@ -308,7 +307,7 @@ static int am7xxx_play(const char *input_format_string,
+ }
+
+ /* allocate an input frame */
+- picture_raw = av_frame_alloc();
++ picture_raw = avcodec_alloc_frame();
+ if (picture_raw == NULL) {
+ fprintf(stderr, "cannot allocate the raw picture frame!\n");
+ ret = -ENOMEM;
+@@ -316,7 +315,7 @@ static int am7xxx_play(const char *input_format_string,
+ }
+
+ /* allocate output frame */
+- picture_scaled = av_frame_alloc();
++ picture_scaled = avcodec_alloc_frame();
+ if (picture_scaled == NULL) {
+ fprintf(stderr, "cannot allocate the scaled picture!\n");
+ ret = -ENOMEM;
+@@ -327,10 +326,9 @@ static int am7xxx_play(const char *input_format_string,
+ picture_scaled->height = (output_ctx.codec_ctx)->height;
+
+ /* calculate the bytes needed for the output image and create buffer for the output image */
+- out_buf_size = av_image_get_buffer_size((output_ctx.codec_ctx)->pix_fmt,
+- (output_ctx.codec_ctx)->width,
+- (output_ctx.codec_ctx)->height,
+- 1);
++ out_buf_size = avpicture_get_size((output_ctx.codec_ctx)->pix_fmt,
++ (output_ctx.codec_ctx)->width,
++ (output_ctx.codec_ctx)->height);
+ out_buf = av_malloc(out_buf_size * sizeof(uint8_t));
+ if (out_buf == NULL) {
+ fprintf(stderr, "cannot allocate output data buffer!\n");
+@@ -339,13 +337,11 @@ static int am7xxx_play(const char *input_format_string,
+ }
+
+ /* assign appropriate parts of buffer to image planes in picture_scaled */
+- av_image_fill_arrays(picture_scaled->data,
+- picture_scaled->linesize,
+- out_buf,
+- (output_ctx.codec_ctx)->pix_fmt,
+- (output_ctx.codec_ctx)->width,
+- (output_ctx.codec_ctx)->height,
+- 1);
++ avpicture_fill((AVPicture *)picture_scaled,
++ out_buf,
++ (output_ctx.codec_ctx)->pix_fmt,
++ (output_ctx.codec_ctx)->width,
++ (output_ctx.codec_ctx)->height);
+
+ sw_scale_ctx = sws_getCachedContext(NULL,
+ (input_ctx.codec_ctx)->width,
+@@ -458,17 +454,17 @@ static int am7xxx_play(const char *input_format_string,
+ }
+ end_while:
+ if (!output_ctx.raw_output && got_packet)
+- av_packet_unref(&out_packet);
+- av_packet_unref(&in_packet);
++ av_free_packet(&out_packet);
++ av_free_packet(&in_packet);
+ }
+
+ sws_freeContext(sw_scale_ctx);
+ cleanup_out_buf:
+ av_free(out_buf);
+ cleanup_picture_scaled:
+- av_frame_free(&picture_scaled);
++ avcodec_free_frame(&picture_scaled);
+ cleanup_picture_raw:
+- av_frame_free(&picture_raw);
++ avcodec_free_frame(&picture_raw);
+
+ cleanup_output:
+ /* av_free is needed as well,
+diff --git a/src/am7xxx.c b/src/am7xxx.c
+index 84d7e9c..f26fc18 100644
+--- a/src/am7xxx.c
++++ b/src/am7xxx.c
+@@ -1106,7 +1106,7 @@ AM7XXX_PUBLIC int am7xxx_init(am7xxx_context **ctx)
+ goto out_free_context;
+ }
+
+- libusb_set_debug((*ctx)->usb_context, LIBUSB_LOG_LEVEL_INFO);
++ libusb_set_debug((*ctx)->usb_context, 3);
+
+ ret = scan_devices(*ctx, SCAN_OP_BUILD_DEVLIST , 0, NULL);
+ if (ret < 0) {