Recherche avancée

Médias (91)

Autres articles (88)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • 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 (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (8448)

  • FPS drop in FFMPEG streaming processes to FB from production server

    30 janvier 2017, par Aakash Gupta

    I have made a rails app that can stream live videos to facebook rtmp server and deployed it on AWS. I have used nginx as web server. The major problem that I am encountering after viewing log files of FFMpeg processes is that sometimes the FPS of FFmpeg process starts to drop. In some cases, it remains stable at 25 FPS but in some cases, it remains at 25 only for sometime, and after that it starts to drop and sometimes it falls to even 3-4 FPS which is unacceptable during live streaming. As FFMpeg process is quite heavy, I would also like to share my CPU info as well.

    CPU information is :

    cat /proc/cpuinfo
    processor   : 0
    vendor_id   : GenuineIntel
    cpu family  : 6
    model       : 63
    model name  : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
    stepping    : 2
    microcode   : 0x25
    cpu MHz     : 2400.070
    cache size  : 30720 KB
    physical id : 0
    siblings    : 1
    core id     : 0
    cpu cores   : 1
    apicid      : 0
    initial apicid  : 0
    fpu     : yes
    fpu_exception   : yes
    cpuid level : 13
    wp      : yes
    flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips    : 4800.14
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 46 bits physical, 48 bits virtual
    power management:

    FFMPEG log file with unstable fps : https://drive.google.com/open?id=0B1gtp1iXJppkUndFamk4M0lRYzA

    FFMPEG log file with stable fps : https://drive.google.com/open?id=0B1gtp1iXJppkMkVCZEJjYWJrVTA

    When FPS was stable, I also tried to run another parallel FFMpeg process from the same server which resulted in FPS dropping of both the processes to 13-14 FPS.

    I am currently using this FFMPEG command :

    ffmpeg -loop 1 -re -y -f image2 -i "image_path" -i "audio_path.aac" -acodec copy -bsf:a aac_adtstoasc -pix_fmt yuv420p -profile:v high -s 1280x720 -vb 400k -maxrate 400k -minrate 400k -bufsize 600k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -t 14400 -strict -2 -f flv "rtmp_server_link"

    I never face this problem when I try to stream to FB using app on my localhost.

    So, my questions are :

    1. What can be the reason for this FPS drop ?
    2. Can upscaling production server help me fix this issue ?
    3. Can I run multiple FFMpeg processes for streaming from same server without performance drop ?

    Thanks in advance :)

  • Creating a simulated HLS live stream from multiple MP4 sources with ffmpeg

    27 janvier 2017, par Navid Gharib

    I’ve already tried to create HLS stream from a UDP continuous input stream, it was fairly easy, now I want to create a simulated live HLS stream from multiple MP4 sources with ffmpeg, the idea behind it is to be able to create a TV channel with non-live data, so the input must be a loop of non-live data to simulate live stream continuity. I tried to do it with the below command but after the first round, ffmpeg exits with this error :

    concat:1.mp4|2.mp4|3.mp4" Resource temporarily unavailable.

    ffmpeg command :

    ffmpeg -i "concat:1.mp4|2.mp4|3.mp4" -strict experimental -sn  -ac  2  -map_metadata  -1  -s  720x576  -g  250  -c:v  libx264  -pix_fmt  yuv420p  -flags  -global_header  -hls_time  10  -hls_list_size  5  -hls_wrap  12  -hls_flags  delete_segments  -f  hls  -strftime  1  -segment_time  10  -segment_format  mpegts  -segment_list_flags  +live  -hls_allow_cache  0  -segment_wrap  12  -segment_list_size  5  -hls_base_url  http://192.168.1.100/0/  -hls_segment_filename  /data/0/live_0_%02d.ts  /data/0/live_0.m3u8

    If anyone has a nice solution to this issue, I would appreciate any input.

    Cheers,
    Navid

  • FFMpeg : write h264 stream to mp4 container without changes

    3 mars 2017, par Bumblebee

    Good day.

    For brevity, the code omits error handling and memory management.

    I want to capture h264 video stream and pack it to mp4 container without changes. Since i don’t control the source of stream, i can not make assumptions about stream structure. In this way i must probe input stream.

       AVProbeData probeData;
       probeData.buf_size = s->BodySize();
       probeData.buf = s->GetBody();
       probeData.filename = "";

       AVInputFormat* inFormat = av_probe_input_format(&probeData, 1);  

    This code correctly defines h264 stream.

    Next, i create input format context,

       unsigned char* avio_input_buffer = reinterpret_cast<unsigned> (av_malloc(AVIO_BUFFER_SIZE));

       AVIOContext* avio_input_ctx = avio_alloc_context(avio_input_buffer, AVIO_BUFFER_SIZE,
           0, this, &amp;read_packet, NULL, NULL);

       AVFormatContext* ifmt_ctx = avformat_alloc_context();
       ifmt_ctx->pb = avio_input_ctx;

       int ret = avformat_open_input(&amp;ifmt_ctx, NULL, inFormat, NULL);
    </unsigned>

    set image size,

       ifmt_ctx->streams[0]->codec->width = ifmt_ctx->streams[0]->codec->coded_width = width;
       ifmt_ctx->streams[0]->codec->height = ifmt_ctx->streams[0]->codec->coded_height = height;

    create output format context,

       unsigned char* avio_output_buffer = reinterpret_cast<unsigned>(av_malloc(AVIO_BUFFER_SIZE));

       AVIOContext* avio_output_ctx = avio_alloc_context(avio_output_buffer, AVIO_BUFFER_SIZE,
           1, this, NULL, &amp;write_packet, NULL);

       AVFormatContext* ofmt_ctx = nullptr;
       avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, "mp4", NULL);
       ofmt_ctx->pb = avio_output_ctx;

       AVDictionary* dict = nullptr;
       av_dict_set(&amp;dict, "movflags", "faststart", 0);
       av_dict_set(&amp;dict, "movflags", "frag_keyframe+empty_moov", 0);

       AVStream* outVideoStream = avformat_new_stream(ofmt_ctx, nullptr);

       avcodec_copy_context(outVideoStream->codec, ifmt_ctx->streams[0]->codec);

       ret = avformat_write_header(ofmt_ctx, &amp;dict);
    </unsigned>

    Initialization is done. Further there is a shifting packets from h264 stream to mp4 container. I dont calculate pts and dts, because source packet has AV_NOPTS_VALUE in them.

       AVPacket pkt;
       while (...)
       {
           ret = av_read_frame(ifmt_ctx, &amp;pkt);
           ret = av_interleaved_write_frame(ofmt_ctx, &amp;pkt);
           av_free_packet(&amp;pkt);
       }

    Further i write trailer and free allocated memory. That is all. Code works and i got playable mp4 file.

    Now the problem : the stream characteristics of the resulting file is not completely consisent with the characteristics of the source stream. In particular, fps and bitrate is higher than it should be.

    As sample, below is output ffplay.exe for source stream

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:/movies/source.mp4':0/0
    Metadata:
        major_brand     : isom
        minor_version   : 1
        compatible_brands: isom
        creation_time   : 2014-04-14T13:03:54.000000Z
    Duration: 00:00:58.08, start: 0.000000, bitrate: 12130 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661),yuv420p, 1920x1080, 12129 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
    Metadata:
        handler_name    : VideoHandler
    Switch subtitle stream from #-1 to #-1 vq= 1428KB sq=    0B f=0/0
    Seek to 49% ( 0:00:28) of total duration ( 0:00:58)       B f=0/0
        30.32 M-V: -0.030 fd=  87 aq=    0KB vq= 1360KB sq=    0B f=0/0  

    and for resulting stream (contains part of source stream)

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:/movies/target.mp4':f=0/0
    Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1iso6mp41
        encoder         : Lavf57.56.101
    Duration: 00:00:11.64, start: 0.000000, bitrate: 18686 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 18683 kb/s, 38.57 fps, 40 tbr, 90k tbn, 50 tbc (default)
    Metadata:
        handler_name    : VideoHandler
    Switch subtitle stream from #-1 to #-1 vq= 2309KB sq=    0B f=0/0
        5.70 M-V:  0.040 fd= 127 aq=    0KB vq= 2562KB sq=    0B f=0/0  

    So there is a question, what i missed when copying stream ? I will be grateful for any help.

    Best regards