Recherche avancée

Médias (1)

Mot : - Tags -/portrait

Autres articles (109)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

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

  • FFmpeg remux rtp to mpegts [closed]

    16 décembre 2013, par Ardoramor

    I am trying to remux rtp stream into mptegts format. I have an SDP file with the following contents :

    v=0
    o=- 0 0 IN IP4 127.0.0.1
    s=Unnamed
    i=N/A
    c=IN IP4 192.168.17.44
    t=0 0
    a=recvonly
    a=orient:portrait
    m=video 8202 RTP/AVP 96
    a=rtpmap:96 H264/90000
    a=fmtp:96 packetization-mode=1;profile-level-id=428028;sprop-parameter-sets=Z0KAKJWgKA9E,aM48gA==;
    a=control:trackID=1

    I execute the following ffmpeg command :

    ffmpeg -i "test.sdp" -f mpegts -vcodec copy "/tmp/test.ts"

    And I get the following information :

    Input #0, sdp, from 'test.sdp':
     Metadata:
       title           : Unnamed
       comment         : N/A
     Duration: N/A, start: 0.066622, bitrate: N/A
       Stream #0.0: Video: h264 (Baseline), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
    [mpegts @ 0x1101d4c0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to '/tmp/test.ts':
     Metadata:
       title           : Unnamed
       comment         : N/A
       encoder         : Lavf53.4.0
       Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0.0 -> #0.0

    I receive the following error :

    [mpegts @ 0x1c85f960] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
    av_interleaved_write_frame(): Operation not permitted

    So I add the suggested bitstream filter :

    ffmpeg -i "test.sdp" -f mpegts -vbsf h264_mp4toannexb "/tmp/test.ts"

    But the h264 encoding now becomes h262 (mpeg2video) :

    ~$ffprobe /tmp/test.ts
    Input #0, mpegts, from '/tmp/test.ts':
     Duration: 00:00:04.13, start: 1.400000, bitrate: 640 kb/s
     Program 1
       Metadata:
         service_name    : Unnamed
         service_provider: FFmpeg
       Stream #0.0[0x100]: Video: mpeg2video (Main), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 104857 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc

    Is there any way to keep the h264 codec without re-encoding it ? Doing so becomes very CPU intensive.

    Update

    Hopefully this will clear up the issue and remove the off-topic stamp.

    I'm writing an Android app that is based off of SpyDroids streaming architecture. The app communicates with the server, providing it the SDP. The server spawns an ffmpeg process to remux the incoming video stream into mpegts and broadcasts it on multicast (right now just file).

    SpyDroid performs streaming by sending recorded mp4 file through localsocket, received h264 packets, supposedly (according to code removed mp4 h264 prefix [annexb]), wraps it with rtp headrs and sends it on its way. Thus, the RPT stream I get is clearly not originally generated as such.

    As @Wagner Patriota has mentioned, I should add '-vcodec copy'. I had run the remuxing with it before as well but the error is still present (full output) :

    ~$ffmpeg -i "test.sdp" -f mpegts -vcodec copy -vbsf h264_mp4toannexb "/tmp/test.ts"
    ffmpeg version 0.8.6, Copyright (c) 2000-2011 the FFmpeg developers
     built on Jan 30 2012 17:17:54 with gcc 4.5.2
     configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --disable-avisynth --enable-libdc1394 --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libx264 --enable-libxvid --extra-cflags='-O2 -g -m64 -mtune=generic -fPIC' --disable-stripping --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-indev=v4l --disable-indev=v4l2
     libavutil    51.  9. 1 / 51.  9. 1
     libavcodec   53.  7. 0 / 53.  7. 0
     libavformat  53.  4. 0 / 53.  4. 0
     libavdevice  53.  1. 1 / 53.  1. 1
     libavfilter   2. 23. 0 /  2. 23. 0
     libswscale    2.  0. 0 /  2.  0. 0
     libpostproc  51.  2. 0 / 51.  2. 0
    [h264 @ 0x16b4b1c0] concealing 232 DC, 232 AC, 232 MV errors
    [h264 @ 0x16b4b1c0] concealing 63 DC, 63 AC, 63 MV errors
    [h264 @ 0x16b4b1c0] concealing 25 DC, 25 AC, 25 MV errors
    [h264 @ 0x16b4b1c0] concealing 138 DC, 138 AC, 138 MV errors
    [h264 @ 0x16b4b1c0] concealing 69 DC, 69 AC, 69 MV errors
    [sdp @ 0x16b43400] Estimating duration from bitrate, this may be inaccurate

    Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 90000.00 (180000/2)
    Input #0, sdp, from 'test.sdp':
     Metadata:
       title           : Unnamed
       comment         : N/A
     Duration: N/A, start: 0.033256, bitrate: N/A
       Stream #0.0: Video: h264 (Baseline), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
    [mpegts @ 0x16b4a4c0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to '/tmp/test.ts':
     Metadata:
       title           : Unnamed
       comment         : N/A
       encoder         : Lavf53.4.0
       Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0.0 -> #0.0
    Press [q] to stop, [?] for help
    h264_mp4toannexb failed for stream 0, codec copy: Invalid argument
    [mpegts @ 0x16b4a4c0] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
    av_interleaved_write_frame(): Operation not permitted

    The error reports that the invalid argument has been supplied. Increased loglevel does not give any more information. I know that ffmpeg is sometimes finicky with argument order. However, they seen to be in order of documentation as well as suggested order by @Wagner Patriota.

  • Convert raw yuv to mp4 crashed on android

    19 décembre 2013, par Sunderr

    Here is my steps :

    1. Decode a jpeg file to rgb565 ;(Success) ;

    2. Convert rgb565 to yuv420 ;(Not sure if it works, function "Bitmap2Yuv420")

    3. Convert yuv420 to mp4. (Crash when call avcodec_open2) ;

    And that is the codes :

    void ADKJpegDecoder::Bitmap2Yuv420(const char * outfilename) {
    unsigned char *destination = new unsigned char[m_Width * m_Height
           * m_BytesPerPixel / 2];
    unsigned char* rgb = m_RawImage;
    size_t image_size = m_Width * m_Height;
    size_t upos = image_size;
    size_t vpos = upos + upos / 4;
    size_t i = 0;

    for (size_t line = 0; line < m_Height; ++line) {
       if (!(line % 2)) {
           for (size_t x = 0; x < m_Width; x += 2) {
               char r = rgb[3 * i];
               char g = rgb[3 * i + 1];
               char b = rgb[3 * i + 2];

               destination[i++] = ((66 * r + 129 * g + 25 * b) >> 8) + 16;

               destination[upos++] = ((-38 * r + -74 * g + 112 * b) >> 8)
                       + 128;
               destination[vpos++] = ((112 * r + -94 * g + -18 * b) >> 8)
                       + 128;

               r = rgb[3 * i];
               g = rgb[3 * i + 1];
               b = rgb[3 * i + 2];

               destination[i++] = ((66 * r + 129 * g + 25 * b) >> 8) + 16;
           }
       } else {
           for (size_t x = 0; x < m_Width; x += 1) {
               char r = rgb[3 * i];
               char g = rgb[3 * i + 1];
               char b = rgb[3 * i + 2];

               destination[i++] = ((66 * r + 129 * g + 25 * b) >> 8) + 16;
           }
       }
    }

    ADKVideoEncoder::getInstance()->startEncodeVideo(destination);
    delete[] destination;

    }

    void ADKVideoEncoder::startEncodeVideo(unsigned char* rawDatas) {
    AVFormatContext* oc;
    AVOutputFormat* fmt;
    AVStream* video_st;
    AVCodecContext* c;

    double video_pts;
    uint8_t* video_outbuf;
    AVFrame* picture;
    int size;
    int ret;
    int video_outbuf_size;

    const char* filename = "/sdcard/test.mpg";

    av_register_all();

    fmt = av_guess_format(NULL, filename, NULL);
    oc = avformat_alloc_context();
    oc->oformat = fmt;
    snprintf(oc->filename, sizeof(oc->filename), "%s", filename);

    video_st = NULL;
    if (fmt->video_codec != CODEC_ID_NONE) {
       video_st = av_new_stream(oc, 0);
       c = video_st->codec;
       c->codec_id = fmt->video_codec;
       c->codec_type = AVMEDIA_TYPE_VIDEO;
       c->bit_rate = 400000;
       c->width = 320;
       c->height = 480;
       c->time_base.num = 1;
       c->time_base.den = 1;
       c->gop_size = 12;
       c->pix_fmt = PIX_FMT_YUV420P;
       c->max_b_frames = 0;
       if (!strcmp(oc->oformat->name, "mp4")
               || !strcmp(oc->oformat->name, "mov")
               || !strcmp(oc->oformat->name, "3gp")) {
           c->flags |= CODEC_FLAG_GLOBAL_HEADER;
       }
    }

    av_dump_format(oc, 0, filename, 1);
    if (video_st) {
       AVCodec* codec = avcodec_find_encoder(c->codec_id);
       if (!codec) {
           return;
       }
       AVDictionary *optionsDict = NULL;
       if (avcodec_open2(c, codec, &optionsDict) < 0) {
           return;
       }
       if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
           video_outbuf_size = 20000;
           video_outbuf = (uint8_t*) av_malloc(video_outbuf_size);
       }
       picture = avcodec_alloc_frame();
       size = avpicture_get_size(c->pix_fmt, c->width, c->height);
       avpicture_fill((AVPicture*) picture, rawDatas, c->pix_fmt, c->width,
               c->height);
    }

    if (!(fmt->flags & AVFMT_NOFILE)) {
       if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
           return;
       }
    }
    avformat_write_header(oc, 0);

    if (video_st) {
       video_pts = (double) (video_st->pts.val * video_st->time_base.num
               / video_st->time_base.den);
    } else {
       video_pts = 0.0;
    }
    if (!video_st/* || video_pts >= 5.0*/) {
       return;
    }
    c = video_st->codec;
    size = c->width * c->height;

    picture->data[0] = rawDatas;
    picture->data[1] = rawDatas + size;
    picture->data[2] = rawDatas + size * 5 / 4;

    if (oc->oformat->flags & AVFMT_RAWPICTURE) {
       AVPacket pkt;
       av_init_packet(&pkt);
       pkt.flags |= AV_PKT_FLAG_KEY;
       pkt.stream_index = video_st->index;
       pkt.data = (uint8_t*) picture;
       pkt.size = sizeof(AVPicture);
       ret = av_write_frame(oc, &pkt);
    } else {
       int out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size,
               picture);
       if (out_size > 0) {
           AVPacket pkt;
           av_init_packet(&pkt);
           pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base,
                   video_st->time_base);
           if (c->coded_frame->key_frame) {
               pkt.flags |= AV_PKT_FLAG_KEY;
           }
           pkt.stream_index = video_st->index;
           pkt.data = video_outbuf;
           pkt.size = out_size;
           ret = av_write_frame(oc, &pkt);
       }
    }

    if (video_st) {
       avcodec_close(video_st->codec);
       av_free(picture);
       av_free(video_outbuf);
    }
    av_write_trailer(oc);
    for (int i = 0; i < oc->nb_streams; i++) {
       av_freep(&oc->streams[i]->codec);
       av_freep(&oc->streams[i]);
    }
    if (!(fmt->flags & AVFMT_NOFILE)) {
       avio_close(oc->pb);
    }
    av_free(oc);

    }

    So can anyone find out the problem ? Thanks very much ! ;

  • ffmpeg mysteriously adding start delay [migrated]

    13 janvier 2014, par swizzcheez

    When converting a mp4 to TS, I am observing ffmpeg adding a "start" delay that the input file did not seem to possess. For my input, ffprobe reveals :

    ffprobe version N-57943-g7b76976 Copyright (c) 2007-2013 the FFmpeg developers
     built on Nov  6 2013 14:00:40 with gcc 4.4.5 (Debian 4.4.5-8)
     configuration: --enable-libx264 --enable-gpl
     libavutil      52. 52.100 / 52. 52.100
     libavcodec     55. 41.100 / 55. 41.100
     libavformat    55. 21.100 / 55. 21.100
     libavdevice    55.  5.100 / 55.  5.100
     libavfilter     3. 90.102 /  3. 90.102
     libswscale      2.  5.101 /  2.  5.101
     libswresample   0. 17.104 /  0. 17.104
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4-in-7A8FEADA-5EA6-11E3-AD13-4DD2258FBC88.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42mp41
       creation_time   : 2013-11-08 15:15:12
     Duration: 00:00:11.56, start: 0.000000, bitrate: 2994 kb/s
       Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 2807 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
       Metadata:
         creation_time   : 2013-11-08 15:15:12
         handler_name    : ?Mainconcept Video Media Handler
       Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
       Metadata:
         creation_time   : 2013-11-08 15:15:12
         handler_name    : #Mainconcept MP4 Sound Media Handler

    But when processed using ffmpeg :

    ffmpeg -i '/tmp/test-no-qp.C2162DFC-6297-11E3-A68D-05E505A3FB93/output.mp4-in-7A8FEADA-5EA6-11E3-AD13-4DD2258FBC88.mp4' -s 1920x1080 -preset ultrafast -f mpegts -c:v libx264 -qp:v 18 `enter code here`

    I get an extra start delay :

    (Snipping the same headers from the input side)
    Input #0, mpegts, from 'output.mp4-out-7A8FEADA-5EA6-11E3-AD13-4DD2258FBC88.mp4':
     Duration: 00:00:11.55, start: 1.400000, bitrate: 1985 kb/s
     Program 1
       Metadata:
         service_name    : Service01
         service_provider: FFmpeg
       Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
       Stream #0:1[0x101](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s

    Duration seems to have been adjusted as well, but I didn't ask for the adjustment. How do I get rid of that ? What did I do that triggered that effect ? Is there something else about my ffmpeg line that looks off ?

    (ffmpeg version is the same as the ffprobe above.)