Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (65)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (10063)

  • Facebook Reels Upload always failing

    21 juin, par Evrard A.

    I'm trying to upload Reels through Facebook Graph API. The video is created with the following ffmpeg command.

    


    cmd = [
            'ffmpeg',
            '-i', video_path,
            '-i', voice_path,
            '-i', music_path,

            '-filter_complex',
            '[1:a]loudnorm=I=-16:LRA=11:TP=-1.5,adelay=0|0[a1];' +
            '[2:a]volume=0.2,afade=t=in:ss=0:d=0.02,afade=t=out:st=28:d=0.03[a2];' +
            '[a1][a2]amix=inputs=2:duration=first:dropout_transition=0[aout]',

            '-map', '0:v:0',
            '-map', '[aout]',

            '-vf',
             f"subtitles='{str(ass_path)}',format=yuv420p,scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2,setsar=1",  # Incrustation des sous-titres

            '-r', '30',
            '-g', '60',
            '-keyint_min', '60',
            '-sc_threshold', '0',
            '-x264opts', 'no-scenecut',

            '-c:v', 'libx264',
            '-profile:v', 'baseline',
            '-level', '4.1',
            '-pix_fmt', 'yuv420p',
            '-color_range', 'tv',
            '-colorspace', 'bt709',

            '-b:v', '9500k',
            '-maxrate', '9500k',
            '-bufsize', '19000k',

            '-c:a', 'aac',
            '-b:a', '192k',
            '-ac', '2',
            '-ar', '48000',

            '-movflags', '+faststart',
            '-video_track_timescale', '15360',
            '-max_muxing_queue_size', '9999',

            '-y', self.output_video_path if self.output_video_path else f'{parts[0]}.subtitled.{parts[1]}'
        ]

        subprocess.run(cmd, check=True)


    


    Here is the class method I use to publish :

    


      import requests, os,  time
  from datetime import datetime, timedelta
  from moviepy.editor import VideoFileClip
   
  def post_reel(
      self,
      page_id: str,
      page_access_token: str,
      video_file_path: str,
      video_description: str,
      tags: list = None, # type: ignore
      publish_now: bool = True
  ):
      def extract_first_frame(video_path: str, output_image_path: str, time_in_seconds: float = 1):
          """
          Extrait une frame à time_in_seconds et la sauvegarde comme miniature.
          """
          try:
              clip = VideoFileClip(video_path)
              clip.save_frame(output_image_path, t=time_in_seconds)
              print(f"[THUMBNAIL] Frame at {time_in_seconds}s saved to {output_image_path}")
              return output_image_path
          except Exception as e:
              print(f"[ERROR] Could not extract thumbnail: {str(e)}")
              return None

      def wait_for_video_ready(video_id, page_access_token, timeout=300, poll_interval=10):
          """
          Attends que la vidéo soit complètement traitée et publiée.
          """
          status_url = f"{self.BASE_API_URL}/{video_id}"
          params = {
              "access_token": page_access_token,
              "fields": "status"
          }

          start = time.time()
          while time.time() - start < timeout:
              try:
                  r = requests.get(url=status_url, params=params)
                  r.raise_for_status()
                  status = r.json().get("status", {})
                  processing = status.get("processing_phase", {}).get("status")
                  publishing = status.get("publishing_phase", {}).get("status")
                  video_status = status.get("video_status")

                  print(f"[WAIT] video_status={video_status}, processing={processing}, publishing={publishing}")

                  if processing == "complete" and publishing == "complete":
                      print("[READY] Reel processed and published")
                      return True
                  elif processing == "error":
                     print(r.json())

              except Exception as e:
                  print(f"[ERROR] during polling: {e}")

              time.sleep(poll_interval)

          print("[TIMEOUT] Video did not finish processing in time.")
          return False

      try:
          # Step 1: Initialize upload
          init_url = f"{self.BASE_API_URL}/{page_id}/video_reels"
          init_params = {"upload_phase": "start"}
          init_payload = {'access_token': page_access_token}

          r = requests.post(url=init_url, data=init_payload, params=init_params)
          r.raise_for_status()
          response = r.json()
          video_id = response["video_id"]
          upload_url = response["upload_url"]
          print(f"[INIT OK] Video ID: {video_id}")

          # Step 2: Upload video
          file_size = os.path.getsize(video_file_path)
          headers = {
              'Authorization': f"OAuth {page_access_token}",
              'offset': "0",
              'file_size': str(file_size),
          }

          with open(video_file_path, 'rb') as f:
              files = {'source': f}
              r = requests.post(url=upload_url, data=files, headers=headers)
              r.raise_for_status()
              upload_response = r.json()

          if not upload_response.get("success"):
              print("[ERROR] Upload failed.")
              return None
          print(f"[UPLOAD OK]")

          # Step 3: Check video status
          status_check_url = f'{self.BASE_API_URL}/{video_id}'
          check_params = {
              "access_token": page_access_token,
              "fields": "status"
          }
          r = requests.get(url=status_check_url, params=check_params)
          r.raise_for_status()
          print(f"[STATUS CHECK] {r.json()}")

          # Step 4: Finalize video
          finalize_params = {
              "video_id": video_id,
              "upload_phase": "finish",
              "published": "true",
              "access_token": page_access_token,
              "video_state": "PUBLISHED" if publish_now else "SCHEDULED",
              "title": video_description,
              "description": video_description
          }

          if not publish_now:
              finalize_params["scheduled_publish_time"] = int((datetime.now() + timedelta(days=1)).timestamp())

          if tags:
              finalize_params["tags"] = ",".join(tags)

          r = requests.post(url=init_url, params=finalize_params, headers=headers)
          r.raise_for_status()
          finalize_response = r.json()
          post_id = finalize_response.get("post_id")
          print(f"[FINALIZE OK] Post ID: {post_id}")
          
          # WAIT UNTIL PUBLISHED
          if not wait_for_video_ready(video_id, page_access_token):
              print("[ERROR] Reel processing timeout or failure")
              return None
          
          # Step 5: Extract and upload thumbnail
          thumbnail_path = f"temp_thumb_{video_id}.jpg"
          if extract_first_frame(video_file_path, thumbnail_path):
              thumb_url = f"{self.BASE_API_URL}/{video_id}/thumbnails"
              with open(thumbnail_path, 'rb') as img:
                  files = {'source': img}
                  thumb_payload = {'access_token': page_access_token}
                  r = requests.post(url=thumb_url, files=files, data=thumb_payload)
                  r.raise_for_status()
                  print("[THUMBNAIL UPLOADED]")
              # Clean up temp file
              os.remove(thumbnail_path)
              print("[THUMBNAIL CLEANED UP]")

          return post_id

      except Exception as e:
          print(f"[ERROR] {str(e)}")
          return None


    


    Here are the logs I get :

    


      

    • [INIT OK] Video ID: 1020853163558419
    • 


    • [UPLOAD OK]
    • 


    • [STATUS CHECK]
    • 


    


    {
  "status": {
    "video_status": "upload_complete",
    "uploading_phase": {
      "status": "complete",
      "bytes_transferred": 37780189
    },
    "processing_phase": {
      "status": "not_started"
    },
    "publishing_phase": {
      "status": "not_started"
    },
    "copyright_check_status": {
      "status": "in_progress"
    }
  },
  "id": "1020853163558419"
}


    


      

    • [FINALIZE OK] Post ID: 122162302376476425
    • 


    • [WAIT] video_status=upload_complete, processing=not_started, publishing=not_started
    • 


    • [WAIT] video_status=error, processing=error, publishing=not_started
    • 


    


    {
  "status": {
    "video_status": "error",
    "uploading_phase": {
      "status": "complete",
      "bytes_transferred": 37780189
    },
    "processing_phase": {
      "status": "error",
      "errors": [
        {
          "code": 1363008,
          "message": "Video Creation failed, please try again."
        }
      ]
    },
    "publishing_phase": {
      "status": "not_started"
    },
    "copyright_check_status": {
      "status": "in_progress"
    }
  },
  "id": "1020853163558419"
}


    


    It seems the error code 1363008 is related to the video properties format but even after following Facebook Reels video format recommandations, I can't make it work.

    


    Can you help me with this please ?

    


    I failed getting usefull help with ChatGPT 😅, and thanks in advance for anyone who answers or comments my question.

    


  • "FFmpeg : Error not transitioning to the next song in Discord Bot's queue."

    1er avril 2024, par noober

    I have 3 modules, but I'm sure the error occurs within this module, and here is the entire code within that module :

    


    import asyncio
import discord
from discord import FFmpegOpusAudio, Embed
import os

async def handle_help(message):
    embed = discord.Embed(
        title="Danh sách lệnh cho Bé Mèo",
        description="Dưới đây là các lệnh mà chủ nhân có thể bắt Bé Mèo phục vụ:",
        color=discord.Color.blue()
    )
    embed.add_field(name="!play", value="Phát một bài hát từ YouTube.", inline=False)
    embed.add_field(name="!pause", value="Tạm dừng bài hát đang phát.", inline=False)
    embed.add_field(name="!resume", value="Tiếp tục bài hát đang bị tạm dừng.", inline=False)
    embed.add_field(name="!skip", value="Chuyển đến bài hát tiếp theo trong danh sách chờ.", inline=False)
    embed.add_field(name="!stop", value="Dừng phát nhạc và cho phép Bé Mèo đi ngủ tiếp.", inline=False)
    # Thêm các lệnh khác theo cùng mẫu trên
    await message.channel.send(embed=embed)

class Song:
    def __init__(self, title, player):
        self.title = title  # Lưu trữ tiêu đề bài hát ở đây
        self.player = player

# Thêm đối tượng Song vào hàng đợi
def add_song_to_queue(guild_id, queues, song):
    queues.setdefault(guild_id, []).append(song)

async def handle_list(message, queues):
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    if os.path.exists(log_file_path):
        with open(log_file_path, "r", encoding="utf-8") as f:
            song_list = f.readlines()

        if song_list:
            embed = discord.Embed(
                title="Danh sách bài hát",
                description="Danh sách các bài hát đã phát:",
                color=discord.Color.blue()
            )

            for i, song in enumerate(song_list, start=1):
                if i == 1:
                    song = "- Đang phát: " + song.strip()
                embed.add_field(name=f"Bài hát {i}", value=song, inline=False)

            await message.channel.send(embed=embed)
        else:
            await message.channel.send("Hiện không có dữ liệu trong file log.")
    else:
        await message.channel.send("File log không tồn tại.")

async def handle_commands(message, client, queues, voice_clients, yt_dl_options, ytdl, ffmpeg_options=None, guild_id=None, data=None):
    # Nếu không có ffmpeg_options, sử dụng các thiết lập mặc định
    if ffmpeg_options is None:
        ffmpeg_options = {
            'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
            'options': '-vn -filter:a "volume=0.25"'
        }
    
    # Khởi tạo voice_client
    if guild_id is None:
        guild_id = message.guild.id

    if guild_id in voice_clients:
        voice_client = voice_clients[guild_id]
    else:
        voice_client = None

    # Xử lý lệnh !play
    if message.content.startswith("!play"):
        try:
            # Kiểm tra xem người gửi tin nhắn có đang ở trong kênh voice không
            voice_channel = message.author.voice.channel
            # Kiểm tra xem bot có đang ở trong kênh voice của guild không
            if voice_client and voice_client.is_connected():
                await voice_client.move_to(voice_channel)
            else:
                voice_client = await voice_channel.connect()
                voice_clients[guild_id] = voice_client
        except Exception as e:
            print(e)

        try:
            query = ' '.join(message.content.split()[1:])
            if query.startswith('http'):
                url = query
            else:
                query = 'ytsearch:' + query
                loop = asyncio.get_event_loop()
                data = await loop.run_in_executor(None, lambda: ytdl.extract_info(query, download=False))
                if not data:
                    raise ValueError("Không có dữ liệu trả về từ YouTube.")
                url = data['entries'][0]['url']

            player = FFmpegOpusAudio(url, **ffmpeg_options)
            # Lấy thông tin của bài hát mới đang được yêu cầu
            title = data['entries'][0]['title']
            duration = data['entries'][0]['duration']
            creator = data['entries'][0]['creator'] if 'creator' in data['entries'][0] else "Unknown"
            requester = message.author.nick if message.author.nick else message.author.name
                    
            # Tạo embed để thông báo thông tin bài hát mới
            embed = discord.Embed(
                title="Thông tin bài hát mới",
                description=f"**Bài hát:** *{title}*\n**Thời lượng:** *{duration}*\n**Tác giả:** *{creator}*\n**Người yêu cầu:** *{requester}*",
                color=discord.Color.green()
            )
            await message.channel.send(embed=embed)
            
            # Sau khi lấy thông tin của bài hát diễn ra, gọi hàm log_song_title với title của bài hát
            # Ví dụ:
            title = data['entries'][0]['title']
            await log_song_title(title)

            # Thêm vào danh sách chờ nếu có bài hát đang phát
            if voice_client.is_playing():
                queues.setdefault(guild_id, []).append(player)
            else:
                voice_client.play(player)
                
        except Exception as e:
            print(e)
            
    if message.content.startswith("!link"):
            try:
                voice_client = await message.author.voice.channel.connect()
                voice_clients[voice_client.guild.id] = voice_client
            except Exception as e:
                print(e)

            try:
                url = message.content.split()[1]

                loop = asyncio.get_event_loop()
                data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=False))

                song = data['url']
                player = discord.FFmpegOpusAudio(song, **ffmpeg_options)

                voice_clients[message.guild.id].play(player)
            except Exception as e:
                print(e)

    # Xử lý lệnh !queue
    elif message.content.startswith("!queue"):
        queue = queues.get(guild_id, [])
        if queue:
            await message.channel.send("Danh sách chờ:")
            for index, item in enumerate(queue, 1):
                await message.channel.send(f"{index}. {item.title}")
        else:
            await message.channel.send("Không có bài hát nào trong danh sách chờ.")

    # Xử lý lệnh !skip
    elif message.content.startswith("!skip"):
        try:
            if voice_client and voice_client.is_playing():
                voice_client.stop()
                await play_next_song(guild_id, queues, voice_client, skip=True)
                await remove_first_line_from_log()
        except Exception as e:
            print(e)

    # Xử lý các lệnh như !pause, !resume, !stop
    elif message.content.startswith("!pause"):
        try:
            if voice_client and voice_client.is_playing():
                voice_client.pause()
        except Exception as e:
            print(e)

    elif message.content.startswith("!resume"):
        try:
            if voice_client and not voice_client.is_playing():
                voice_client.resume()
        except Exception as e:
            print(e)

    elif message.content.startswith("!stop"):
        try:
            if voice_client:
                voice_client.stop()
                await voice_client.disconnect()
                del voice_clients[guild_id]  # Xóa voice_client sau khi dừng
        except Exception as e:
            print(e)

async def log_song_title(title):
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        # Kiểm tra xem tệp tin log đã tồn tại chưa
        if not os.path.exists(log_file_path):
            # Nếu chưa tồn tại, tạo tệp tin mới và ghi title vào tệp tin đó
            with open(log_file_path, 'w', encoding='utf-8') as file:
                file.write(title + '\n')
        else:
            # Nếu tệp tin log đã tồn tại, mở tệp tin và chèn title vào cuối tệp tin
            with open(log_file_path, 'a', encoding='utf-8') as file:
                file.write(title + '\n')
    except Exception as e:
        print(f"Error logging song title: {e}")

async def remove_first_line_from_log():
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        with open(log_file_path, "r", encoding="utf-8") as f:
            lines = f.readlines()
        # Xóa dòng đầu tiên trong list lines
        lines = lines[1:]
        with open(log_file_path, "w", encoding="utf-8") as f:
            for line in lines:
                f.write(line)
    except Exception as e:
        print(f"Error removing first line from log: {e}")
        
async def clear_log_file():
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        with open(log_file_path, "w", encoding="utf-8") as f:
            f.truncate(0)
    except Exception as e:
        print(f"Error clearing log file: {e}")


async def play_next_song(guild_id, queues, voice_client, skip=False):
    queue = queues.get(guild_id, [])
    if queue:
        player = queue.pop(0)
        voice_client.play(player, after=lambda e: asyncio.run_coroutine_threadsafe(play_next_song(guild_id, queues, voice_client, skip=False), voice_client.loop))
        if skip:
            return
        else:
            await remove_first_line_from_log()  # Xóa dòng đầu tiên trong file log
    elif skip:
        await remove_first_line_from_log()  # Xóa dòng đầu tiên trong file log
        await voice_client.disconnect()
        del voice_client[guild_id]  # Xóa voice_client sau khi dừng
    else:
        await clear_log_file()  # Xóa dòng đầu tiên trong file log
        await voice_client.disconnect()
        del voice_client[guild_id]  # Xóa voice_client sau khi dừng


    


    I have tried asking ChatGPT, Gemini, or Bing, and they always lead me into a loop of errors that cannot be resolved. This error only occurs when the song naturally finishes playing due to its duration. If the song is playing and I use the command !skip, the next song in the queue will play and function normally. I noticed that it seems like if a song ends naturally, the song queue is also cleared immediately. I hope someone can help me with this

    


  • When using libva* (ffmpeg) encoded GIF images, an error is reported when compiling the demo

    10 août 2023, par yangjinhui2936

    issuse : I need to use the GIF encoding feature in FFMPEG to encode argb images as gifs.Because the encoding effect of using GIF library is not as good as the effect of FFMPEG.
However, several libraries like avcodec were too bulky, so I did some cropping.I just want to keep the functionality of GIF encoding.
Below is my makefile for cropping ffmpeg :

    


    #!/bin/sh
# ./configure --prefix=$(pwd)/output --arch=arm --target-os=linux --enable-cross-compile --disable-asm --cross-prefix=arm-linux-gnueabihf- 
./configure --prefix=$(pwd)/output --target-os=linux --disable-asm \
--disable-gpl --enable-nonfree --enable-error-resilience --enable-debug --enable-shared --enable-small --enable-zlib \
--disable-ffmpeg --disable-ffprobe --disable-ffplay --disable-programs --disable-symver\
 --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-decoder=h264 --enable-avformat \
 --disable-txtpages --enable-avcodec --enable-avutil \
 --disable-avresample --disable-avfilter --disable-avdevice --disable-postproc \
 --disable-swscale --enable-decoder=gif --enable-demuxer=gif --enable-muxer=gif --disable-iconv \
 --disable-v4l2-m2m --disable-indevs --disable-outdevs

make clean
make -j8

make install


    


    Then link the compiled so to the gif demo.
Blew is gif demo code(He was automatically generated by chatgpt, and I want to verify it) :

    


    #include 
// #include "output/include/imgutils.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"

int main() {
    AVCodec *enc_codec;
    AVCodecContext *enc_ctx = NULL;
    AVStream *stream = NULL;
    int ret;

    AVFormatContext *fmt_ctx = avformat_alloc_context();
    if (!fmt_ctx) {
        fprintf(stderr, "Could not allocate format context\n");
        return 1;
    }
    
    AVInputFormat *input_fmt = av_find_input_format("image2");
    if ((ret = avformat_open_input(&fmt_ctx, "input.bmp", input_fmt, NULL)) < 0) {
        fprintf(stderr, "Could not open input file %d\n", ret);
        return ret;
    }

    AVCodec *dec_codec = avcodec_find_decoder(AV_CODEC_ID_BMP);
    if (!dec_codec) {
        fprintf(stderr, "Decoder not found\n");
        return 1;
    }
    
    AVCodecContext *dec_ctx = avcodec_alloc_context3(dec_codec);
    if (!dec_ctx) {
        fprintf(stderr, "Could not allocate decoder context\n");
        return 1;
    }

    if ((ret = avcodec_open2(dec_ctx, dec_codec, NULL)) < 0) {
        fprintf(stderr, "Could not open decoder\n");
        return 1;
    }

    AVOutputFormat *out_fmt = av_guess_format("gif", NULL, NULL);
    if (!out_fmt) {
        fprintf(stderr, "Could not find output format\n");
        return 1;
    }

    AVFormatContext *out_ctx = NULL;
    if ((ret = avformat_alloc_output_context2(&out_ctx, out_fmt, NULL, NULL)) < 0) {
        fprintf(stderr, "Could not allocate output context\n");
        return 1;
    }

    stream = avformat_new_stream(out_ctx, NULL);
    if (!stream) {
        fprintf(stderr, "Could not create new stream\n");
        return 1;
    }

    enc_codec = avcodec_find_encoder(AV_CODEC_ID_GIF);
    if (!enc_codec) {
        fprintf(stderr, "Encoder not found\n");
        return 1;
    }

    enc_ctx = avcodec_alloc_context3(enc_codec);
    if (!enc_ctx) {
        fprintf(stderr, "Could not allocate encoder context\n");
        return 1;
    }

    if ((ret = avcodec_parameters_from_context(stream->codecpar, dec_ctx)) < 0) {
        fprintf(stderr, "Could not copy decoder parameters\n");
        return 1;
    }

    if ((ret = avcodec_open2(enc_ctx, enc_codec, NULL)) < 0) {
        fprintf(stderr, "Could not open encoder\n");
        return 1;
    }
    
    enc_ctx->pix_fmt = AV_PIX_FMT_RGB8; 
    enc_ctx->width = dec_ctx->width; 
    enc_ctx->height = dec_ctx->height; 
    enc_ctx->time_base = (AVRational){1, 25}; 

    avformat_init_output(out_ctx, NULL);

    if (!(out_fmt->flags & AVFMT_NOFILE)) {
        if ((ret = avio_open(&out_ctx->pb, "output.gif", AVIO_FLAG_WRITE)) < 0) {
            fprintf(stderr, "Could not open output file\n");
            return ret;
        }
    }

    avformat_write_header(out_ctx, NULL);

    AVFrame *frame = av_frame_alloc();
    AVPacket pkt;
    int frame_count = 0;

    while (av_read_frame(fmt_ctx, &pkt) >= 0) {
        avcodec_send_packet(dec_ctx, &pkt);
        while (avcodec_receive_frame(dec_ctx, frame) == 0) {
            avcodec_send_frame(enc_ctx, frame);
            while (avcodec_receive_packet(enc_ctx, &pkt) == 0) {
                pkt.stream_index = stream->index;
                av_interleaved_write_frame(out_ctx, &pkt);
                av_packet_unref(&pkt);
            }

            frame_count++;
            printf("Encoded frame %d\n", frame_count);
        }
        av_packet_unref(&pkt);
    }

    av_write_trailer(out_ctx);

    avcodec_close(enc_ctx);
    avcodec_free_context(&enc_ctx);
    avcodec_close(dec_ctx);
    avcodec_free_context(&dec_ctx);
    av_frame_free(&frame);

    avformat_close_input(&fmt_ctx);
    avformat_free_context(fmt_ctx);
    avio_close(out_ctx->pb);
    avformat_free_context(out_ctx);

    return 0;
}



    


    Belw is shell of compile script for gif :

    


    #!/bin/sh
gcc -o x2gif x2gif.c -L ./output/lib/ -l:libavformat.a -l:libavcodec.a -l:libavutil.a -lz -I ./output/include/


    


    Unfortunately, the compilation did not pass.
How can I troubleshoot and resolve this issue ?

    


    ./output/lib/libavutil.a(lfg.o): In function `av_bmg_get':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/lfg.c:59: undefined reference to `log'
./output/lib/libavutil.a(hwcontext_cuda.o): In function `cuda_free_functions':
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:175: undefined reference to `dlclose'
./output/lib/libavutil.a(hwcontext_cuda.o): In function `cuda_load_functions':
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:192: undefined reference to `dlopen'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:194: undefined reference to `dlsym'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:195: undefined reference to `dlsym'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:196: undefined reference to `dlsym'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:197: undefined reference to `dlsym'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:198: undefined reference to `dlsym'
./output/lib/libavutil.a(hwcontext_cuda.o):/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:199: more undefined references to `dlsym' follow
./output/lib/libavutil.a(rational.o): In function `av_d2q':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/rational.c:120: undefined reference to `floor'
./output/lib/libavutil.a(eval.o): In function `eval_expr':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:184: undefined reference to `exp'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:185: undefined reference to `exp'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:189: undefined reference to `floor'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:190: undefined reference to `ceil'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:191: undefined reference to `trunc'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:192: undefined reference to `round'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:263: undefined reference to `pow'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:300: undefined reference to `floor'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:309: undefined reference to `pow'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:315: undefined reference to `hypot'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:316: undefined reference to `atan2'
./output/lib/libavutil.a(eval.o): In function `ff_exp10':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/ffmath.h:44: undefined reference to `exp2'
./output/lib/libavutil.a(eval.o): In function `parse_primary':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:417: undefined reference to `sinh'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:418: undefined reference to `cosh'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:419: undefined reference to `tanh'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:420: undefined reference to `sin'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:421: undefined reference to `cos'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:422: undefined reference to `tan'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:423: undefined reference to `atan'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:424: undefined reference to `asin'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:425: undefined reference to `acos'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:426: undefined reference to `exp'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:427: undefined reference to `log'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:428: undefined reference to `fabs'