diff --git a/repos/libports/lib/import/import-avutil.mk b/repos/libports/lib/import/import-avutil.mk
index 658a21a9db..e104f32f35 100644
--- a/repos/libports/lib/import/import-avutil.mk
+++ b/repos/libports/lib/import/import-avutil.mk
@@ -1,3 +1,3 @@
 include $(call select_from_repositories,lib/import/import-av.inc)
 
-REP_INC_DIR += include/libavutil
+REP_INC_DIR += src/lib/libav
diff --git a/repos/libports/lib/mk/spec/x86/avutil.inc b/repos/libports/lib/mk/spec/x86/avutil.inc
index 328171cb9e..ad131dfe15 100644
--- a/repos/libports/lib/mk/spec/x86/avutil.inc
+++ b/repos/libports/lib/mk/spec/x86/avutil.inc
@@ -5,4 +5,6 @@ CC_C_OPT += -DARCH_X86=1
 
 include $(REP_DIR)/lib/mk/avutil.inc
 
+INC_DIR += $(REP_DIR)/src/lib/libav
+
 -include $(LIBAVUTIL_DIR)/x86/Makefile
diff --git a/repos/libports/lib/symbols/avcodec b/repos/libports/lib/symbols/avcodec
new file mode 100644
index 0000000000..3edf85d737
--- /dev/null
+++ b/repos/libports/lib/symbols/avcodec
@@ -0,0 +1,151 @@
+av_bitstream_filter_close T
+av_bitstream_filter_filter T
+av_bitstream_filter_init T
+av_bitstream_filter_next T
+av_codec_is_decoder T
+av_codec_is_encoder T
+av_codec_next T
+av_dct_calc T
+av_dct_end T
+av_dct_init T
+av_destruct_packet T
+av_dup_packet T
+av_dv_codec_profile T
+av_dv_frame_profile T
+av_fast_padded_malloc T
+av_fft_calc T
+av_fft_end T
+av_fft_init T
+av_fft_permute T
+av_free_packet T
+av_get_audio_frame_duration T
+av_get_bits_per_sample T
+av_get_codec_tag_string T
+av_get_exact_bits_per_sample T
+av_get_profile_name T
+av_grow_packet T
+av_hwaccel_next T
+av_imdct_calc T
+av_imdct_half T
+av_init_packet T
+av_lockmgr_register T
+av_log_ask_for_sample T
+av_log_missing_feature T
+av_mdct_calc T
+av_mdct_end T
+av_mdct_init T
+av_new_packet T
+av_packet_copy_props T
+av_packet_free_side_data T
+av_packet_from_data T
+av_packet_get_side_data T
+av_packet_move_ref T
+av_packet_new_side_data T
+av_packet_ref T
+av_packet_rescale_ts T
+av_packet_shrink_side_data T
+av_packet_unref T
+av_parser_change T
+av_parser_close T
+av_parser_init T
+av_parser_next T
+av_parser_parse2 T
+av_picture_copy T
+av_picture_crop T
+av_picture_pad T
+av_rdft_calc T
+av_rdft_end T
+av_rdft_init T
+av_register_bitstream_filter T
+av_register_codec_parser T
+av_register_hwaccel T
+av_shrink_packet T
+av_xiphlacing T
+avcodec_align_dimensions T
+avcodec_align_dimensions2 T
+avcodec_alloc_context3 T
+avcodec_alloc_frame T
+avcodec_close T
+avcodec_configuration T
+avcodec_copy_context T
+avcodec_decode_audio4 T
+avcodec_decode_subtitle2 T
+avcodec_decode_video2 T
+avcodec_default_execute T
+avcodec_default_execute2 T
+avcodec_default_get_buffer T
+avcodec_default_get_buffer2 T
+avcodec_default_get_format T
+avcodec_default_reget_buffer T
+avcodec_default_release_buffer T
+avcodec_descriptor_get T
+avcodec_descriptor_get_by_name T
+avcodec_descriptor_next T
+avcodec_encode_audio2 T
+avcodec_encode_subtitle T
+avcodec_encode_video2 T
+avcodec_fill_audio_frame T
+avcodec_find_best_pix_fmt2 T
+avcodec_find_decoder T
+avcodec_find_decoder_by_name T
+avcodec_find_encoder T
+avcodec_find_encoder_by_name T
+avcodec_flush_buffers T
+avcodec_free_context T
+avcodec_free_frame T
+avcodec_get_chroma_sub_sample T
+avcodec_get_class T
+avcodec_get_context_defaults3 T
+avcodec_get_edge_width T
+avcodec_get_frame_defaults T
+avcodec_get_pix_fmt_loss T
+avcodec_get_type T
+avcodec_is_open T
+avcodec_license T
+avcodec_open2 T
+avcodec_pix_fmt_to_codec_tag T
+avcodec_register T
+avcodec_register_all T
+avcodec_set_dimensions T
+avcodec_string T
+avcodec_version T
+avpicture_alloc T
+avpicture_deinterlace T
+avpicture_fill T
+avpicture_free T
+avpicture_get_size T
+avpicture_layout T
+avpriv_aac_parse_header T
+avpriv_ac3_channel_layout_tab R 16
+avpriv_ac3_parse_header T
+avpriv_align_put_bits T
+avpriv_copy_bits T
+avpriv_copy_pce_data T
+avpriv_dca_sample_rates R 64
+avpriv_dirac_parse_sequence_header T
+avpriv_find_start_code T
+avpriv_flac_is_extradata_valid T
+avpriv_flac_parse_streaminfo T
+avpriv_lock_avformat T
+avpriv_mjpeg_bits_ac_chrominance R 17
+avpriv_mjpeg_bits_ac_luminance R 17
+avpriv_mjpeg_bits_dc_chrominance R 17
+avpriv_mjpeg_bits_dc_luminance R 17
+avpriv_mjpeg_val_ac_chrominance R 162
+avpriv_mjpeg_val_ac_luminance R 162
+avpriv_mjpeg_val_dc R 12
+avpriv_mpa_bitrate_tab R 180
+avpriv_mpa_decode_header T
+avpriv_mpa_freq_tab R 6
+avpriv_mpeg4audio_get_config T
+avpriv_mpeg4audio_sample_rates R 64
+avpriv_mpegaudio_decode_header T
+avpriv_put_string T
+avpriv_split_xiph_headers T
+avpriv_tak_parse_streaminfo T
+avpriv_toupper4 T
+avpriv_unlock_avformat T
+avpriv_vorbis_parse_extradata T
+avpriv_vorbis_parse_frame T
+avpriv_vorbis_parse_reset T
+avsubtitle_free T
diff --git a/repos/libports/lib/symbols/avfilter b/repos/libports/lib/symbols/avfilter
new file mode 100644
index 0000000000..865b65411e
--- /dev/null
+++ b/repos/libports/lib/symbols/avfilter
@@ -0,0 +1,47 @@
+av_buffersink_get_frame T
+av_buffersink_get_samples T
+av_buffersink_read T
+av_buffersink_read_samples T
+av_buffersrc_add_frame T
+av_buffersrc_buffer T
+av_buffersrc_write_frame T
+av_filter_next T
+avfilter_config_links T
+avfilter_configuration T
+avfilter_copy_buf_props T
+avfilter_copy_buffer_ref_props T
+avfilter_copy_frame_props T
+avfilter_free T
+avfilter_get_audio_buffer_ref_from_arrays T
+avfilter_get_by_name T
+avfilter_get_class T
+avfilter_get_video_buffer_ref_from_arrays T
+avfilter_graph_add_filter T
+avfilter_graph_alloc T
+avfilter_graph_alloc_filter T
+avfilter_graph_config T
+avfilter_graph_create_filter T
+avfilter_graph_free T
+avfilter_graph_get_filter T
+avfilter_graph_parse T
+avfilter_graph_parse2 T
+avfilter_init_dict T
+avfilter_init_filter T
+avfilter_init_str T
+avfilter_inout_alloc T
+avfilter_inout_free T
+avfilter_insert_filter T
+avfilter_license T
+avfilter_link T
+avfilter_next T
+avfilter_open T
+avfilter_pad_count T
+avfilter_pad_get_name T
+avfilter_pad_get_type T
+avfilter_ref_buffer T
+avfilter_register T
+avfilter_register_all T
+avfilter_uninit T
+avfilter_unref_buffer T
+avfilter_unref_bufferp T
+avfilter_version T
diff --git a/repos/libports/lib/symbols/avformat b/repos/libports/lib/symbols/avformat
new file mode 100644
index 0000000000..b04564644c
--- /dev/null
+++ b/repos/libports/lib/symbols/avformat
@@ -0,0 +1,101 @@
+av_add_index_entry T
+av_append_packet T
+av_codec_get_id T
+av_codec_get_tag T
+av_convert_lang_to T
+av_dump_format T
+av_filename_number_test T
+av_find_best_stream T
+av_find_default_stream_index T
+av_find_input_format T
+av_get_frame_filename T
+av_get_packet T
+av_guess_codec T
+av_guess_format T
+av_hex_dump T
+av_hex_dump_log T
+av_iformat_next T
+av_index_search_timestamp T
+av_interleaved_write_frame T
+av_match_ext T
+av_new_program T
+av_oformat_next T
+av_pkt_dump2 T
+av_pkt_dump_log2 T
+av_probe_input_buffer T
+av_probe_input_format T
+av_probe_input_format2 T
+av_read_frame T
+av_read_pause T
+av_read_play T
+av_register_all T
+av_register_input_format T
+av_register_output_format T
+av_sdp_create T
+av_seek_frame T
+av_stream_get_side_data T
+av_url_split T
+av_write_frame T
+av_write_trailer T
+avformat_alloc_context T
+avformat_close_input T
+avformat_configuration T
+avformat_find_stream_info T
+avformat_free_context T
+avformat_get_class T
+avformat_get_riff_audio_tags T
+avformat_get_riff_video_tags T
+avformat_license T
+avformat_network_deinit T
+avformat_network_init T
+avformat_new_stream T
+avformat_open_input T
+avformat_query_codec T
+avformat_seek_file T
+avformat_version T
+avformat_write_header T
+avio_alloc_context T
+avio_check T
+avio_close T
+avio_close_dyn_buf T
+avio_closep T
+avio_enum_protocols T
+avio_flush T
+avio_get_str T
+avio_get_str16be T
+avio_get_str16le T
+avio_open T
+avio_open2 T
+avio_open_dyn_buf T
+avio_pause T
+avio_printf T
+avio_put_str T
+avio_put_str16le T
+avio_r8 T
+avio_rb16 T
+avio_rb24 T
+avio_rb32 T
+avio_rb64 T
+avio_read T
+avio_rl16 T
+avio_rl24 T
+avio_rl32 T
+avio_rl64 T
+avio_seek T
+avio_seek_time T
+avio_size T
+avio_w8 T
+avio_wb16 T
+avio_wb24 T
+avio_wb32 T
+avio_wb64 T
+avio_wl16 T
+avio_wl24 T
+avio_wl32 T
+avio_wl64 T
+avio_write T
+avpriv_dv_get_packet T
+avpriv_dv_init_demux T
+avpriv_dv_produce_packet T
+avpriv_new_chapter T
+avpriv_set_pts_info T
diff --git a/repos/libports/lib/symbols/avresample b/repos/libports/lib/symbols/avresample
new file mode 100644
index 0000000000..f569a08e29
--- /dev/null
+++ b/repos/libports/lib/symbols/avresample
@@ -0,0 +1,21 @@
+avresample_alloc_context T
+avresample_available T
+avresample_build_matrix T
+avresample_close T
+avresample_config T
+avresample_configuration T
+avresample_convert T
+avresample_convert_frame T
+avresample_free T
+avresample_get_class T
+avresample_get_delay T
+avresample_get_matrix T
+avresample_get_out_samples T
+avresample_is_open T
+avresample_license T
+avresample_open T
+avresample_read T
+avresample_set_channel_mapping T
+avresample_set_compensation T
+avresample_set_matrix T
+avresample_version T
diff --git a/repos/libports/lib/symbols/avutil b/repos/libports/lib/symbols/avutil
new file mode 100644
index 0000000000..a77e597079
--- /dev/null
+++ b/repos/libports/lib/symbols/avutil
@@ -0,0 +1,285 @@
+__bss_start R 0
+__eh_frame_start__ R 0
+__exidx_end D 0
+__exidx_start D 0
+__l4sys_invoke_indirect D 0
+_ctors_end D 0
+_ctors_start D 0
+_edata R 0
+_end B 0
+_init T
+_parent_cap D 0
+_parent_cap_local_name D 0
+_parent_cap_thread_id D 0
+av_add_q T
+av_adler32_update T
+av_aes_alloc T
+av_aes_crypt T
+av_aes_init T
+av_aes_size R 4
+av_audio_fifo_alloc T
+av_audio_fifo_drain T
+av_audio_fifo_free T
+av_audio_fifo_read T
+av_audio_fifo_realloc T
+av_audio_fifo_reset T
+av_audio_fifo_size T
+av_audio_fifo_space T
+av_audio_fifo_write T
+av_base64_decode T
+av_base64_encode T
+av_basename T
+av_blowfish_crypt T
+av_blowfish_crypt_ecb T
+av_blowfish_init T
+av_bmg_get T
+av_buffer_alloc T
+av_buffer_allocz T
+av_buffer_create T
+av_buffer_default_free T
+av_buffer_is_writable T
+av_buffer_make_writable T
+av_buffer_pool_get T
+av_buffer_pool_init T
+av_buffer_pool_uninit T
+av_buffer_realloc T
+av_buffer_ref T
+av_buffer_unref T
+av_channel_layout_extract_channel T
+av_compare_mod T
+av_compare_ts T
+av_cpu_count T
+av_crc T
+av_crc_get_table T
+av_crc_init T
+av_ctz T
+av_d2q T
+av_d2str T
+av_default_item_name T
+av_des_crypt T
+av_des_init T
+av_des_mac T
+av_dict_copy T
+av_dict_count T
+av_dict_free T
+av_dict_get T
+av_dict_parse_string T
+av_dict_set T
+av_dirname T
+av_display_matrix_flip T
+av_display_rotation_get T
+av_display_rotation_set T
+av_div_q T
+av_downmix_info_update_side_data T
+av_evaluate_lls T
+av_expr_eval T
+av_expr_free T
+av_expr_parse T
+av_expr_parse_and_eval T
+av_fast_malloc T
+av_fast_realloc T
+av_fifo_alloc T
+av_fifo_drain T
+av_fifo_free T
+av_fifo_generic_read T
+av_fifo_generic_write T
+av_fifo_realloc2 T
+av_fifo_reset T
+av_fifo_size T
+av_fifo_space T
+av_file_map T
+av_file_unmap T
+av_find_info_tag T
+av_find_nearest_q_idx T
+av_frame_alloc T
+av_frame_clone T
+av_frame_copy T
+av_frame_copy_props T
+av_frame_free T
+av_frame_get_buffer T
+av_frame_get_plane_buffer T
+av_frame_get_side_data T
+av_frame_is_writable T
+av_frame_make_writable T
+av_frame_move_ref T
+av_frame_new_side_data T
+av_frame_ref T
+av_frame_remove_side_data T
+av_frame_unref T
+av_free T
+av_freep T
+av_gcd T
+av_get_bits_per_pixel T
+av_get_bytes_per_sample T
+av_get_channel_layout T
+av_get_channel_layout_channel_index T
+av_get_channel_layout_nb_channels T
+av_get_channel_layout_string T
+av_get_channel_name T
+av_get_cpu_flags T
+av_get_default_channel_layout T
+av_get_packed_sample_fmt T
+av_get_picture_type_char T
+av_get_pix_fmt T
+av_get_pix_fmt_name T
+av_get_pix_fmt_string T
+av_get_planar_sample_fmt T
+av_get_random_seed T
+av_get_sample_fmt T
+av_get_sample_fmt_name T
+av_get_sample_fmt_string T
+av_get_time_base_q T
+av_get_token T
+av_gettime T
+av_hmac_alloc T
+av_hmac_calc T
+av_hmac_final T
+av_hmac_free T
+av_hmac_init T
+av_hmac_update T
+av_image_alloc T
+av_image_check_sar T
+av_image_check_size T
+av_image_copy T
+av_image_copy_plane T
+av_image_fill_linesizes T
+av_image_fill_max_pixsteps T
+av_image_fill_pointers T
+av_image_get_linesize T
+av_init_lls T
+av_isdigit T
+av_isgraph T
+av_isspace T
+av_isxdigit T
+av_lfg_init T
+av_log T
+av_log2 T
+av_log2_16bit T
+av_log_default_callback T
+av_log_get_level T
+av_log_set_callback T
+av_log_set_flags T
+av_log_set_level T
+av_lzo1x_decode T
+av_malloc T
+av_mallocz T
+av_match_name T
+av_md5_alloc T
+av_md5_final T
+av_md5_init T
+av_md5_size R 4
+av_md5_sum T
+av_md5_update T
+av_memcpy_backptr T
+av_mul_q T
+av_nearer_q T
+av_opt_child_class_next T
+av_opt_child_next T
+av_opt_eval_double T
+av_opt_eval_flags T
+av_opt_eval_float T
+av_opt_eval_int T
+av_opt_eval_int64 T
+av_opt_eval_q T
+av_opt_find T
+av_opt_find2 T
+av_opt_flag_is_set T
+av_opt_free T
+av_opt_get T
+av_opt_get_dict_val T
+av_opt_get_double T
+av_opt_get_int T
+av_opt_get_q T
+av_opt_next T
+av_opt_set T
+av_opt_set_bin T
+av_opt_set_defaults T
+av_opt_set_dict T
+av_opt_set_dict_val T
+av_opt_set_double T
+av_opt_set_int T
+av_opt_set_q T
+av_opt_show2 T
+av_parse_color T
+av_parse_cpu_flags T
+av_parse_time T
+av_parse_video_rate T
+av_parse_video_size T
+av_pix_fmt_count_planes T
+av_pix_fmt_desc_get T
+av_pix_fmt_desc_get_id T
+av_pix_fmt_desc_next T
+av_pix_fmt_descriptors D 3936
+av_pix_fmt_get_chroma_sub_sample T
+av_pix_fmt_swap_endianness T
+av_rc4_crypt T
+av_rc4_init T
+av_read_image_line T
+av_realloc T
+av_realloc_array T
+av_reallocp T
+av_reallocp_array T
+av_reduce T
+av_rescale T
+av_rescale_q T
+av_rescale_q_rnd T
+av_rescale_rnd T
+av_reverse R 256
+av_sample_fmt_is_planar T
+av_samples_alloc T
+av_samples_copy T
+av_samples_fill_arrays T
+av_samples_get_buffer_size T
+av_samples_set_silence T
+av_set_cpu_flags_mask T
+av_set_options_string T
+av_sha_alloc T
+av_sha_final T
+av_sha_init T
+av_sha_size R 4
+av_sha_update T
+av_solve_lls T
+av_stereo3d_alloc T
+av_stereo3d_create_side_data T
+av_strcasecmp T
+av_strdup T
+av_strerror T
+av_stristart T
+av_stristr T
+av_strlcat T
+av_strlcatf T
+av_strlcpy T
+av_strncasecmp T
+av_strndup T
+av_strnstr T
+av_strstart T
+av_strtod T
+av_sub_q T
+av_timegm T
+av_tree_destroy T
+av_tree_enumerate T
+av_tree_find T
+av_tree_insert T
+av_tree_node_alloc T
+av_tree_node_size R 4
+av_update_lls T
+av_usleep T
+av_vlog T
+av_write_image_line T
+av_xtea_crypt T
+av_xtea_init T
+avpriv_float_dsp_init T
+avpriv_init_lls T
+avpriv_open T
+avpriv_report_missing_feature T
+avpriv_request_sample T
+avpriv_scalarproduct_float_c T
+avpriv_set_systematic_pal2 T
+avpriv_solve_lls T
+avutil_configuration T
+avutil_license T
+avutil_version T
+ff_float_dsp_init_x86 T
+ff_get_cpu_flags_x86 T
+ff_init_lls_x86 T
+ff_log2_tab R 256
diff --git a/repos/libports/lib/symbols/swscale b/repos/libports/lib/symbols/swscale
new file mode 100644
index 0000000000..39a68066f5
--- /dev/null
+++ b/repos/libports/lib/symbols/swscale
@@ -0,0 +1,36 @@
+sws_addVec T
+sws_allocVec T
+sws_alloc_context T
+sws_cloneVec T
+sws_context_class D 56
+sws_convVec T
+sws_convertPalette8ToPacked24 T
+sws_convertPalette8ToPacked32 T
+sws_format_name T
+sws_freeContext T
+sws_freeFilter T
+sws_freeVec T
+sws_getCachedContext T
+sws_getCoefficients T
+sws_getColorspaceDetails T
+sws_getConstVec T
+sws_getContext T
+sws_getDefaultFilter T
+sws_getGaussianVec T
+sws_getIdentityVec T
+sws_get_class T
+sws_init_context T
+sws_isSupportedEndiannessConversion T
+sws_isSupportedInput T
+sws_isSupportedOutput T
+sws_normalizeVec T
+sws_printVec2 T
+sws_rgb2rgb_init T
+sws_scale T
+sws_scaleVec T
+sws_setColorspaceDetails T
+sws_shiftVec T
+sws_subVec T
+swscale_configuration T
+swscale_license T
+swscale_version T
diff --git a/repos/libports/ports/libav.hash b/repos/libports/ports/libav.hash
index ec25bcf790..05ffd01f8c 100644
--- a/repos/libports/ports/libav.hash
+++ b/repos/libports/ports/libav.hash
@@ -1 +1 @@
-e1e1614656d888a857f450f4315dcaa669569c42
+3a860e68b2ca999d64f965997d2329628dfd46c6
diff --git a/repos/libports/ports/libav.port b/repos/libports/ports/libav.port
index 04a93a289e..37d45fcffe 100644
--- a/repos/libports/ports/libav.port
+++ b/repos/libports/ports/libav.port
@@ -10,7 +10,7 @@ SIG(libav) := ${URL(libav)}.asc
 PATCHES := src/app/avplay/avplay.patch \
            src/lib/libav/avcodec.patch
 
-include_subdirs := . libavcodec libavfilter libavutil libavformat libswscale \
+include_subdirs := . libavcodec libavdevice libavfilter libavutil libavformat libswscale \
                    libavutil/x86 libavutil/arm libavutil/ppc libavcodec/x86 \
                    libavcodec/arm libavresample
 
diff --git a/repos/libports/recipes/api/libav/content.mk b/repos/libports/recipes/api/libav/content.mk
new file mode 100644
index 0000000000..6b7b3b9d0f
--- /dev/null
+++ b/repos/libports/recipes/api/libav/content.mk
@@ -0,0 +1,27 @@
+MIRROR_FROM_REP_DIR := lib/symbols/avcodec \
+                       lib/symbols/avfilter \
+                       lib/symbols/avformat \
+                       lib/symbols/avresample \
+                       lib/symbols/avutil \
+                       lib/import/import-av.inc \
+                       lib/import/import-avcodec.mk \
+                       lib/import/import-avfilter.mk \
+                       lib/import/import-avformat.mk \
+                       lib/import/import-avresample.mk \
+                       lib/import/import-avutil.mk \
+                       lib/symbols/swscale lib/import/import-swscale.mk
+
+content: $(MIRROR_FROM_REP_DIR) include LICENSE
+
+$(MIRROR_FROM_REP_DIR):
+	$(mirror_from_rep_dir)
+
+PORT_DIR := $(call port_dir,$(REP_DIR)/ports/libav)
+
+include:
+	mkdir -p $@
+	cp -r $(PORT_DIR)/include/libav/* $@/
+	cp -r $(REP_DIR)/src/lib/libav/libavutil $@/
+
+LICENSE:
+	cp $(PORT_DIR)/src/lib/libav/LICENSE $@
diff --git a/repos/libports/recipes/api/libav/hash b/repos/libports/recipes/api/libav/hash
new file mode 100644
index 0000000000..143db3fe31
--- /dev/null
+++ b/repos/libports/recipes/api/libav/hash
@@ -0,0 +1 @@
+2017-11-27 19e2f88fa8695b391de83f64b2487ddf7ed010ce
diff --git a/repos/libports/recipes/src/libav/api b/repos/libports/recipes/src/libav/api
new file mode 100644
index 0000000000..e7f62afc35
--- /dev/null
+++ b/repos/libports/recipes/src/libav/api
@@ -0,0 +1 @@
+libav
diff --git a/repos/libports/recipes/src/libav/content.mk b/repos/libports/recipes/src/libav/content.mk
new file mode 100644
index 0000000000..147107dd83
--- /dev/null
+++ b/repos/libports/recipes/src/libav/content.mk
@@ -0,0 +1,26 @@
+content: src/lib/libav/target.mk lib/import lib/mk LICENSE
+
+PORT_DIR := $(call port_dir,$(REP_DIR)/ports/libav)
+
+src/lib/libav:
+	mkdir -p $@
+	cp -r $(PORT_DIR)/src/lib/libav/* $@
+	cp -r $(REP_DIR)/src/lib/libav/* $@
+
+src/lib/libav/target.mk: src/lib/libav
+	echo "LIBS += avfilter avformat avcodec avutil avresample swscale" > $@
+
+lib/import:
+	mkdir -p $@
+	cp $(REP_DIR)/lib/import/import-av* $@
+	cp $(REP_DIR)/lib/import/import-swscale.mk $@
+
+lib/mk:
+	mkdir -p $@
+	cp $(addprefix $(REP_DIR)/$@/,av* swscale.mk) $@
+	for spec in x86 x86_32 x86_64 arm; do \
+	  mkdir -p $@/spec/$$spec; \
+	  cp $(addprefix $(REP_DIR)/$@/spec/$$spec/,av*) $@/spec/$$spec/; done
+
+LICENSE:
+	cp $(PORT_DIR)/src/lib/libav/LICENSE $@
diff --git a/repos/libports/recipes/src/libav/hash b/repos/libports/recipes/src/libav/hash
new file mode 100644
index 0000000000..554dad613b
--- /dev/null
+++ b/repos/libports/recipes/src/libav/hash
@@ -0,0 +1 @@
+2017-12-05 dbf0878fd7cfc17675b9e7c4ba7417d52e41d4c2
diff --git a/repos/libports/recipes/src/libav/used_apis b/repos/libports/recipes/src/libav/used_apis
new file mode 100644
index 0000000000..8f11c5d1ee
--- /dev/null
+++ b/repos/libports/recipes/src/libav/used_apis
@@ -0,0 +1,3 @@
+so
+libc
+zlib
diff --git a/repos/libports/include/libavutil/avconfig.h b/repos/libports/src/lib/libav/libavutil/avconfig.h
similarity index 100%
rename from repos/libports/include/libavutil/avconfig.h
rename to repos/libports/src/lib/libav/libavutil/avconfig.h