Recherche avancée

Médias (1)

Mot : - Tags -/géodiversité

Autres articles (51)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

Sur d’autres sites (4345)

  • where can i find the file and android write in JNI

    14 janvier 2016, par chaoqi

    I wirte a test demo for ffmpeg, read a flac file and decoder it to a new pcm file.

    after done the work, i could not find the output file.

    so I open the output file with a new FILE pointer, and open is ok, does anybody give any tips, thanks.

    static int decode_packet(int *got_frame, int cached)
    {
       int ret = 0;
       int decoded = pkt.size;

       *got_frame = 0;

       if (pkt.stream_index == audio_stream_idx) {
           /* decode audio frame */
           ret = avcodec_decode_audio4(audio_dec_ctx, frame, got_frame, &pkt);
           if (ret < 0) {
               LOG("Error decoding audio frame (%s)\n", av_err2str(ret));
               return ret;
           }

           decoded = FFMIN(ret, pkt.size);

           if (*got_frame) {
               LOG("frame->format: %d", frame->format);
               size_t unpadded_linesize = frame->nb_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16/*frame->format*/);
               LOG("audio_frame%s n:%d nb_samples:%d pts:%s\n", cached ? "(cached)" : "", audio_frame_count++, frame->nb_samples,
                      av_ts2timestr(frame->pts, &audio_dec_ctx->time_base));

               fwrite(frame->extended_data[0], 1, unpadded_linesize, audio_dst_file);
           }
       }

       if (*got_frame && api_mode == API_MODE_NEW_API_REF_COUNT)
           av_frame_unref(frame);

       return decoded;
    }

       // as convient i write the abspath `/storage/emulated/0` which i got by rountine Environment.getExternalStorageDirectory().getAbsolutePath()
       const char *src_filename = "/storage/emulated/0/pyghlkn.flac";
       const char *audio_dst_filename = "/storage/emulated/0/test.pcm";

       FILE *audio_dst_file = NULL;
       FILE *audio_dump = NULL;

       JNIEXPORT void JNICALL Java_cn_com_longmaster_ffmpeg_encoder
         (JNIEnv *, jobject)
         {
             //......
               /* read frames from the file */
               while (av_read_frame(fmt_ctx, &pkt) >= 0) {
                   AVPacket orig_pkt = pkt;
                   do {
                       ret = decode_packet(&got_frame, 0);
                       LOG("write decode_packet... pkt.size: %d ", pkt.size);
                       if (ret < 0)
                           break;
                       pkt.data += ret;
                       pkt.size -= ret;
                   } while (pkt.size > 0);
                   av_free_packet(&orig_pkt);
               }

               /* flush cached frames */
               pkt.data = NULL;
               pkt.size = 0;
               do {
                   decode_packet(&got_frame, 1);
                   LOG("flush cached frames");
               } while (got_frame);


               if (audio_dump)
               {
                   LOG("default audio_dump ready...");
               }
               else
               {
                   LOG("default audio_dump not ready...");
               }

               audio_dump = fopen(audio_dst_filename, "rb");
               if (audio_dump) {
                   LOG("open pcm file ok...");
               } else {
                   LOG("open pcm file fail...");
               }

               avcodec_close(audio_dec_ctx);
               avformat_close_input(&fmt_ctx);
               if (audio_dst_file) {
                   fclose(audio_dst_file);
               }

               av_frame_free(&frame);

               return ;

         }
  • apache caught SIGWINCH, shutting down gracefully

    6 septembre 2024, par damii1

    I need your help please.
This is what happening : I'm trying to generate a video thanks to ffmpeg.
To do so I have a directory where I put the medias (video and images) I want to put on my final video.
Then once my files ready to be used (right bitrate, resolution, and so on...), I call a python script that generates the ffmpeg code to produce my video.

    


    The python script is called from my php script with the escapeshellcmd command.

    


    Problem is my apache server keeps crashing each time I try to produce a video.

    


    In the error log I see this :
[mpm_prefork:notice] [pid 745] AH00170 : caught SIGWINCH, shutting down gracefully

    


    Could someone help or give me hint please ?

    


    Thanks a lot,
Damien

    


  • How to slow down the ouput speed of ffmpeg while streaming to a RTMP server ?

    25 avril 2023, par Loc Bui Nhien

    I'm currently trying to process multipul short videos (each is about 0.5s long) to be stream on a RTMP server. However, the output/fps/speed when sending is too high (results printed here), making the server crashed very often.

    


    Here is the the code and settings that I'm using :

    


    import cv2
import ffmpeg
import av
import numpy as np
import os
import subprocess

url = "rtmp://..."
key = "..."
rtmp_url = url + "/" + key

cap = cv2.VideoCapture('traffic.mp4')

# gather video info to ffmpeg
fps = int(cap.get(cv2.CAP_PROP_FPS))
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

# command and params for ffmpeg
command = ['ffmpeg',
           '-y',
           '-f', 'rawvideo',
           '-vcodec', 'rawvideo',
           '-pix_fmt', 'bgr24',
           '-s', "{}x{}".format(width, height),
           '-i', '-',
           '-r', '20',
           '-c:v', 'libx264',
           '-pix_fmt', 'yuv420p',
           '-preset', 'slow',
           '-f', 'flv',
           rtmp_url]

# using subprocess and pipe to fetch frame data
p = subprocess.Popen(command, stdin=subprocess.PIPE, shell=True)

received_video_path = 'ReceivedRecording'
while True:
    video_files = [filenames for filenames in sorted(os.listdir(received_video_path), reverse=True)]
    # Loop through the videos and concatenate them
    for filename in video_files[:len(video_files)-3]:
        video = cv2.VideoCapture(os.path.join(received_video_path,filename))

        # Loop through the frames of each video
        while True:
            ret, frame = video.read()
            if not ret:
                # End of video, move to next video
                video.release()
                break
            
            p.stdin.write(frame.tobytes())

        os.remove(os.path.join(received_video_path, filename))


    


    The same settings work fine with the webcam, but I can not control the speed and fps of it sending to the server. The stream on the server seems to work fine with a steady 20fps as intended.