Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (106)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, 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 (...)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (10312)

  • Youtube-dl and Ffmpeg

    25 juin 2022, par Joksy

    i have made a music bot with discord.py, but i get this info thing and it doesnt work anymore error [youtube] QxYdBvB8sOY: Downloading webpage 985104597242773505 [2022-06-25 07:45:51] [INFO    ] discord.player: Preparing to terminate ffmpeg process 37580. [2022-06-25 07:45:51] [INFO    ] discord.player: ffmpeg process 37580 has not terminated. Waiting to terminate... [2022-06-25 07:45:51] [INFO    ] discord.player: ffmpeg process 37580 should have terminated with a return code of 1. this is my code

    


    import discord
import os
import asyncio
import youtube_dl
from discord import *

token = "token is here"
prefix = "j!"
blocked_words = ["blocked words are here"]

voice_clients = {}

yt_dl_opts = {'format': 'bestaudio/best'}
ytdl = youtube_dl.YoutubeDL(yt_dl_opts)

ffmpeg_options = {'options': "-vn"}

intents = discord.Intents.default()
intents.message_content = True

client = discord.Client(intents=intents)


programmer_role = "987018590152699964"
            


@client.event
async def on_ready():
    print(f"Bot logged in as {client.user}")

@client.event
async def on_message(msg):
    if msg.author != client.user:
        if msg.content.lower().startswith(f"{prefix}info"):
            await msg.channel.send(f"Hi, Im JoksysBot Made By Joksy!")

        for text in blocked_words:
            if text in str(msg.content.lower()):
                await msg.delete()
                await msg.channel.send("Hey, Dont Say That!")
                return
        if msg.content.startswith(f"{prefix}play"):

            try:
                voice_client = await msg.author.voice.channel.connect()
                voice_clients[voice_client.guild.id] = voice_client
            except:
                print("error")

            try:
                url = msg.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.FFmpegPCMAudio(song, **ffmpeg_options, executable="C:\\Users\\jonas\\Documents\\ffmpeg-2022-06-16-git-5242ede48d-full_build\\ffmpeg-2022-06-16-git-5242ede48d-full_build\\bin\\ffmpeg.exe")

                voice_clients[msg.guild.id].play(player)

            except Exception as err:
                print(err)

        if msg.content.startswith(f"{prefix}pause"):
            try:
                voice_clients[msg.guild.id].pause()
            except Exception as err:
                print(err)

        if msg.content.startswith(f"{prefix}resume"):
            try:
                voice_clients[msg.guild.id].resume()
            except Exception as err:
                print(err)

        if msg.content.startswith(f"{prefix}stop"):
            try:
                voice_clients[msg.guild.id].stop()
                await voice_clients[msg.guild.id].disconnect()
            except Exception as err:
                print(err)

client.run(token)



    


    its weird since all the other code in my bot works fine like the !info command, so it must be an error with either youtube-dl or ffmpeg. But then again it doesnt join the voice call in the first place so that might be the error. i added ffmpeg to path but i still wrote the path to it here player = discord.FFmpegPCMAudio(song, **ffmpeg_options, executable="C:\\Users\\jonas\\Documents\\ffmpeg-2022-06-16-git-5242ede48d-full_build\\ffmpeg-2022-06-16-git-5242ede48d-full_build\\bin\\ffmpeg.exe"). i followed this tutorial for the bot https://www.youtube.com/watch?v=Q8wxin72h50&t=1040s i did everything he did but it didnt work. My discord.py version is 2.0.0 my Python version is 3.10.5 and my youtube_dl version is 2021.12.17 my ffmpeg download is ffmpeg-2022-06-16-git-5242ede48d-full_build. I tested it on discord.py 1.73 and it worked fine. This was in intellij though whilst my main program is in Visual Studio Code but i couldnt see it making any big difference so it could be the intents that makes the program not work.I couldnt see any mistakes in the code but im new to discord.py, youtube_dl and ffmpeg stuff so unless visual studio code showed me what i did wrong, i wouldnt notice. But what did i do wrong and how can i fix it ?

    


  • FFmpeg encoding in c

    25 décembre 2012, par barisatbas

    I have been working on a project about video summarization on android platfrom. and I am stuck in encoding. I think ;
    first I must convert my frame into RGB Frame, then convert that RGB FRame into YUV Frame. Then encode the frame. After this operations, The output video was so weird. I think I missed something. Here is my las optimized code. Maybe someone has an experiement in this subject.

    Its syntax is changed according to android ndk syntax :

    jint Java_com_test_Test_encodeVideo(JNIEnv* env, jobject javaThis)
    {
        char *flname, *err, *info;
        AVCodec *codec;
        AVCodecContext *c= NULL;
        int i,out_size, size, x, y,z, outbuf_size;
        int frameCount=99;
        FILE *f;
        AVFrame *picture, *yuvFrame;
        uint8_t *outbuf, *picture_buf;
        PPMImage *img;
        const char *destfilename = "/sdcard/new.mp4";
        int             numBytes;
        uint8_t         *buffer;

        av_register_all();
        // must be called before using avcodec lib
        avcodec_init();

        // register all the codecs
        avcodec_register_all();
        log_message("Video encoding\n");

        // find the H263 video encoder
        codec = avcodec_find_encoder(CODEC_ID_H263);
        if (!codec) {
            sprintf(err, "codec not found\n");
            log_message(err);
        }

        c= avcodec_alloc_context();
        picture= avcodec_alloc_frame();
        yuvFrame= avcodec_alloc_frame();

        // get first ppm context. it is because I need width and height values.
        img = getPPM("/sdcard/frame1.ppm");

        c->bit_rate = 400000;
        // resolution must be a multiple of two

        c->width = img->x;
        c->height = img->y;
        free(img);
        // frames per second
        c->time_base= (AVRational){1,25};
        c->gop_size = 10; // emit one intra frame every ten frames
        //c->max_b_frames=1;
        c->pix_fmt = PIX_FMT_YUV420P;
        // open it
        if (avcodec_open(c, codec) < 0){
       log_message("codec couldn't open");
       return -1;
        }
        //destfilename = (*env)->GetStringUTFChars(env, dst, 0);
        f = fopen(destfilename, "wb");
        log_message(destfilename);
        if (!f) {
            sprintf(err, "could not open %s", destfilename);
            log_message(err);
        }

        log_message("after destination file opening");
        // alloc image and output buffer
        outbuf_size = 100000;
        outbuf = malloc(outbuf_size);
        size = c->width * c->height;
        picture_buf = malloc(size * 3); // size for RGB
        picture->data[0] = picture_buf;
        picture->data[1] = picture->data[0] + size;
        picture->data[2] = picture->data[1] + size / 4;
        picture->linesize[0] = c->width;
        picture->linesize[1] = c->width / 2;
        picture->linesize[2] = c->width / 2;

        numBytes=avpicture_get_size(PIX_FMT_YUV420P, c->width,
                 c->height);

        buffer=malloc(numBytes);

             // Assign appropriate parts of buffer to image planes in FrameYUV
        avpicture_fill((AVPicture *)yuvFrame, buffer, PIX_FMT_YUV420P,
                 c->width, c->height);
        // encode the video
        log_message("before for loop");
        for(z=1;zsdcard/frame%d.ppm",z);
                            // read the ppm file
                            img = getPPM(flname);
                            picture->data[0] = img->data;
                            // convert the rgb frame into yuv frame
                            rgb2yuv(picture,yuvFrame,c);
                            log_message("translation completed.");
                            // encode the image
                            out_size = avcodec_encode_video(c, outbuf, outbuf_size, yuvFrame);
                            sprintf(info,"encoding frame %3d (size=%5d)\n", z, out_size);
                            log_message(info);
                            fwrite(outbuf, 1, out_size, f);
                            free(img);
        }

        // get the delayed frames
        for(; out_size; i++) {
            //fflush(stdout);
            out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
            sprintf(info,"write frame %3d (size=%5d)\n", i, out_size);
                log_message(info);
            fwrite(outbuf, 1, out_size, f);
        }

        // add sequence end code to have a real mpeg file
        outbuf[0] = 0x00;
        outbuf[1] = 0x00;
        outbuf[2] = 0x01;
        outbuf[3] = 0xb7;
        fwrite(outbuf, 1, 4, f);
        fclose(f);
        free(picture_buf);
        free(outbuf);

        avcodec_close(c);
        av_free(c);
        av_free(picture);
        av_free(yuvFrame);
    }

    int rgb2yuv(AVFrame *frameRGB, AVFrame *frameYUV, AVCodecContext *c)
    {
           char *err;
           static struct SwsContext *img_convert_ctx;


           log_message("conversion starts");
           // Convert the image into YUV format from RGB format
           if(img_convert_ctx == NULL) {
                   int w = c->width;
                   int h = c->height;

                   img_convert_ctx = sws_getContext(w, h, PIX_FMT_RGB24,w, h, c->pix_fmt, SWS_BICUBIC,NULL, NULL, NULL);

                   if(img_convert_ctx == NULL) {
                           sprintf(err, "Cannot initialize the conversion context!\n");
                           log_message(err);
                           return -1;
                   }
           }
     int ret = sws_scale(img_convert_ctx,frameRGB->data, frameRGB->linesize , 0,c->height,frameYUV->data, frameYUV->linesize );
           return;
    }
  • Ffmpeg conversion from RTSP to RTMP stops transmitting video in a Odroid C4 device

    14 mars 2023, par JuanN

    We hace a video camera (transmitting using RTSP) connected to an Odroid C4. We want to send the streaming to a OvenMediaEngine using RTMP. For us to achieve this goal, we run this command :

    


    ffmpeg -rtsp_transport tcp -nostdin -i "rtsp://admin:xxxxxx@aaa.aaa.a.aaa:ppp//h264Preview_01_sub" -threads 1 -cod
ec copy -f flv -flvflags no_duration_filesize -an "rtmp://xxxxx.xxxx.xx:pppp/xxxxxxx"


    


    Apparently the transmition is fine but, after a while (this "while" ranges from a few hours to a few days) the ffmpeg command stops working, with the following message [rtsp @ 0x55a46347b0] CSeq 3005 expected :

    


    ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rtsp, from 'rtsp://admin:xxxxxx@aaa.aaa.a.aaa:ppp//h264Preview_01_sub':
  Metadata:
    title           : Session streamed by "preview"
    comment         : h264Preview_01_sub
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x360, 25 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Output #0, flv, to 'rtmp://xxxxx.xxxx.xx:pppp/xxxxxxx':
  Metadata:
    title           : Session streamed by "preview"
    comment         : h264Preview_01_sub
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p(progressive), 640x360, q=2-31, 25 tbr, 1k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
[flv @ 0x55a463c220] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[rtsp @ 0x55a46347b0] CSeq 3005 expected, 0 received.1:25.81 bitrate= 207.3kbits/s speed=   1x
    Last message repeated 1 times


    


    We thought at first this was due to the limitation of ffmpeg when it is run on background (that's the reason for the nostdin option), but it keeps on failing. Looking online, we also found that it could be some issue of the file size (hence the no_duration_filesize option).

    


    The weird part is the process is still running (if you check it using a top or ps command) when it fails, but it has to be rebooted to resume the transmision.

    


    Any clues will be most welcome !
Thank you.