Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (51)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (9752)

  • Streaming Rtsp stream to website using FFmpeg and FFserver.

    23 août 2016, par Pallav Gupta

    I am working on a website for a client and one of the requirement is to embed the video from HikVision DVR DS7116. I have the RTSP url for the DVR. I want help with FFmpeg and FFserver. I already have written my ffserver config file.

    /etc/ffserver.config

    Port 9500
    # bind to all IPs aliased or not
    BindAddress 0.0.0.0
    # max number of simultaneous clients
    MaxClients 1000
    # max bandwidth per-client (kb/s)
    MaxBandwidth 10000
    # Suppress that if you want to launch ffserver as a daemon.
    NoDaemon

    <feed>
    File /tmp/feed1.ffm
    FileMaxSize 5M
    </feed>

    <stream>
    Feed feed1.ffm
    Format swf
    VideoCodec flv
    VideoFrameRate 15
    VideoBufferSize 80000
    VideoBitRate 100
    VideoQMin 1
    VideoQMax 5
    VideoSize 352x288
    PreRoll 0
    Noaudio
    </stream>

    I next run my ffserver and ffmpeg command which is

    ffserver &amp; ffmpeg -re -i rtsp://admin:12345@192.168.1.3/MPEG-4/ch1/main/av_stream  http://192.168.1.105:9500/feed1.ffm

    The output which i receive is as follows

    ffmpeg version N-80901-gfebc862 Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
     configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab

     libavutil      55. 28.100 / 55. 28.100
     libavcodec     57. 48.101 / 57. 48.101
     libavformat    57. 41.100 / 57. 41.100
     libavdevice    57.  0.102 / 57.  0.102
     libavfilter     6. 47.100 /  6. 47.100
     libavresample   3.  0.  0 /  3.  0.  0
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  1.100 /  2.  1.100
     libpostproc    54.  0.100 / 54.  0.100

    [rtsp @ 0x20c4720] Missing PPS in sprop-parameter-sets, ignoring
    [h264 @ 0x20c7f60] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x20c7f60] decode_slice_header error
    [h264 @ 0x20c7f60] no frame!
    [rtsp @ 0x20c4720] RTP: missed 1137 packets
    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 1125 packets
    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 1126 packets

    Guessed Channel Layout for Input Stream #0.1 : mono
    Input #0, rtsp, from 'rtsp://admin:12345@192.168.1.3/MPEG-4/ch1/main/av_stream':
     Metadata:
       title           : HIK Media Server
       comment         : HIK Media Server Session Description : standard
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: h264 (Baseline), yuv420p, 352x288, 10 fps, 25 tbr, 90k tbn, 20 tbc
       Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s
    [ffm @ 0x21c0e80] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.

    Output #0, ffm, to 'http://192.168.1.105:9500/feed1.ffm':
     Metadata:
       title           : HIK Media Server
       comment         : HIK Media Server Session Description : standard
       creation_time   : now
       encoder         : Lavf57.41.100
       Stream #0:0: Video: flv1 (flv), yuv420p, 352x288, q=1-5, 100 kb/s, 10 fps, 1000k tbn, 15 tbc

       Metadata:
         encoder         : Lavc57.48.101 flv
       Side data:
         cpb: bitrate max/min/avg: 200000/0/100000 buffer size: 655360000 vbv_delay: -1

    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv))
    Press [q] to stop, [?] for help
    frame=    0 fps=0.0 q=0.0 size=       4kB time=00:00:00.00 bitrate=N/A speed=   frame=    0 fps=0.0 q=0.0 size=       4kB time=00:00:00.00 bitrate=N/A speed=   frame=    0 fps=0.0 q=0.0 size=       4kB time=00:00:00.00 bitrate=N/A speed=   Past duration 1.003319 too large
       Last message repeated 1 times
    Past duration 1.005333 too large
    frame=   31 fps= 15 q=31.0 size=      56kB time=00:00:02.00 bitrate= 229.4kbits/Past duration 1.005653 too large
    Past duration 1.005989 too large
    frame=   37 fps= 15 q=24.8 size=      76kB time=00:00:02.40 bitrate= 259.4kbits/Past duration 1.006660 too large
    Past duration 1.006996 too large
    frame=   46 fps= 15 q=31.0 size=      80kB time=00:00:03.00 bitrate= 218.5kbits/Past duration 1.007988 too large
    Past duration 1.008659 too large
    frame=   53 fps= 15 q=31.0 size=      96kB time=00:00:03.46 bitrate= 226.9kbits/Past duration 1.009987 too large
    Past duration 1.010323 too large
    frame=   61 fps= 15 q=24.8 size=     116kB time=00:00:04.00 bitrate= 237.6kbits/Past duration 1.010994 too large
    Past duration 1.011330 too large
    Past duration 1.011986 too large
    frame=   68 fps= 15 q=31.0 size=     120kB time=00:00:04.46 bitrate= 220.1kbits/Past duration 1.012657 too large

    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 1114 packets
    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 1115 packets
    Past duration 1.012993 too large
    frame=   76 fps= 15 q=31.0 size=     140kB time=00:00:05.00 bitrate= 229.4kbits/Past duration 1.013664 too large
    Past duration 1.014320 too large
    Past duration 1.014656 too large
    frame=   83 fps= 15 q=31.0 size=     144kB time=00:00:05.46 bitrate= 215.8kbits/Past duration 1.015327 too large
    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 1103 packets
    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 1104 packets

    Past duration 1.015999 too large
    frame=   91 fps= 15 q=31.0 size=     160kB time=00:00:06.00 bitrate= 218.5kbits/Past duration 1.016655 too large
    Past duration 1.017326 too large
    Past duration 1.017998 too large
    frame=   98 fps= 15 q=31.0 size=     180kB time=00:00:06.46 bitrate= 228.0kbits/Past duration 1.018654 too large
    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 1092 packets
    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 1093 packets
    Past duration 1.019325 too large
    frame=  106 fps= 15 q=31.0 size=     184kB time=00:00:07.00 bitrate= 215.3kbits/Past duration 1.019997 too large
    [rtsp @ 0x20c4720] max delay reached. need to consume packet
    [rtsp @ 0x20c4720] RTP: missed 35 packets
    Past duration 1.020653 too large
    frame=  161 fps= 15 q=31.0 size=     264kB time=00:00:10.66 bitrate= 202.8kbits/Past duration 1.032661 too large
    Past duration 1.033333 too large
    frame=  167 fps= 15 q=31.0 Lsize=     276kB time=00:00:11.06 bitrate= 204.3kbits/s dup=94 drop=0 speed=0.964x
    video:265kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.280833%

    I can see that with some errors, the stream starts.
    When i put the output url in my html code, there is no stream. I also tried playing the network stream in VLC and did not get anything. Can anyone please help me with that ? Any leads are also appreciated. Thank you.

    My HTML Code is :

  • FFmpeg / libavcodec : Encoding with x264 ignores bitrate setting

    16 août 2016, par Fasteno

    I am trying to write a video using the FFmpeg libraries. So far I can successfully encode videos with the .avi extension, but when I use the .mp4 extension the application ignores completely the bitrate option I specify.

    Here’s a snippet of the code I use to specify the encoding settings :

    //define video stream
    AVOutputFormat* outFmt = nullptr;
    outFmt = av_guess_format(NULL, m_pcFilename.c_str(), NULL);
    avformat_alloc_output_context2(&amp;m_pcOC, outFmt, NULL, NULL);
    AVFormatContext* m_pcOC;
    AVStream* m_pcVideoSt = avformat_new_stream(m_pcOC, NULL);
    AVCodec* codec = nullptr;
    codec = avcodec_find_encoder(codecID);
    avcodec_get_context_defaults3(m_pcVideoSt->codec, codec);
    //set some parameters
    double dBitrate = std::stod(bitrate);
    m_pcVideoSt->codec->codec_id = codecID;
    m_pcVideoSt->codec->codec_type = AVMEDIA_TYPE_VIDEO;
    m_pcVideoSt->codec->bit_rate = dBitrate;
    m_pcVideoSt->codec->bit_rate_tolerance = 20000;
    m_pcVideoSt->codec->width = m_iOutCols;
    m_pcVideoSt->codec->height = m_iOutRows;
    m_pcVideoSt->codec->time_base.den = static_cast<int>(dFps);
    m_pcVideoSt->codec->time_base.num = 1;
    if (m_pcOC->oformat->flags &amp; AVFMT_GLOBALHEADER)
    {
     m_pcVideoSt->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
    }
    /* open the codec */
    AVDictionary* pcOpts = nullptr;
    int res1 = av_dict_set(&amp;pcOpts, "b", bitrate.c_str(), 0);
    int res = avcodec_open2(m_pcVideoSt->codec, codec, &amp;pcOpts);
    </int>

    This is the output I get when creating a .avi file

    ffprobe version 2.8.6 Copyright (c) 2007-2016 the FFmpeg developers
    built with gcc 5.3.0 (GCC)
    configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
    libavutil      54. 31.100 / 54. 31.100
    libavcodec     56. 60.100 / 56. 60.100
    libavformat    56. 40.101 / 56. 40.101
    libavdevice    56.  4.100 / 56.  4.100
    libavfilter     5. 40.101 /  5. 40.101
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  2.101 /  1.  2.101
    libpostproc    53.  3.100 / 53.  3.100
    Input #0, avi, from 'testGrey2.avi':
    Metadata:
    encoder         : Lavf56.40.101
    Duration: 00:01:20.00, start: 0.000000, **bitrate: 433 kb/s**
    Stream #0:0: Video: **mpeg4 (Advanced Simple Profile)** (FMP4 / 0x34504D46), yuv420p, 720x576 [SAR 1:1 DAR 5:4], 428 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc

    And this is what I get when creating an .mp4 file

    ffprobe version 2.8.6 Copyright (c) 2007-2016 the FFmpeg developers
    built with gcc 5.3.0 (GCC)
    configuration: --disable-static --enable-shared --enable-gpl --enable-    version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-    libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
    libavutil      54. 31.100 / 54. 31.100
    libavcodec     56. 60.100 / 56. 60.100
    libavformat    56. 40.101 / 56. 40.101
    libavdevice    56.  4.100 / 56.  4.100
    libavfilter     5. 40.101 /  5. 40.101
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  2.101 /  1.  2.101
    libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testGrey2.mp4':
    Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
    Duration: 00:01:20.00, start: 0.000000, **bitrate: 1542 kb/s**
    Stream #0:0(und): **Video: h264 (High)** (avc1 / 0x31637661), yuv420p, 720x576, 1540 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
     handler_name    : VideoHandler

    Any ideas on why is this happening ? What is the preferred way to specify the bitrate of the output video ?

  • Approaches To Modifying Game Resource Files

    16 août 2016, par Multimedia Mike — Game Hacking

    I have been assisting The Translator in the translation of another mid-1990s adventure game. This one isn’t quite as multimedia-heavy as the last title, and the challenges are a bit different. I wanted to compose this post in order to describe my thought process and mental model in approaching this problem. Hopefully, this will help some others understand my approach since what I’m doing here often appears as magic to some of my correspondents.

    High Level Model
    At the highest level, it is valuable to understand the code and the data at play. The code is the game’s engine and the data refers to the collection of resources that comprise the game’s graphics, sound, text, and other assets.


    High-level game engine model
    Simplistic high-level game engine model

    Ideally, we want to change the data in such a way that the original game engine adopts it as its own because it has the same format as the original data. It is very undesirable to have to modify the binary engine executable in any way.

    Modifying The Game Data Directly
    How to modify the data ? If we modify the text strings for the sake of language translation, one approach might be to search for strings within the game data files and change them directly. This model assumes that the text strings are stored in a plain, uncompressed format. Some games might store these strings in a text format which can be easily edited with any text editor. Other games will store them as binary data.

    In the latter situation, a game hacker can scan through data files with utilities like Unix ‘strings’ to find the resources with the desired strings. Then, use a hex editor to edit the strings directly. For example, change “Original String”…

    0098F800   00 00 00 00  00 00 00 4F  72 69 67 69  6E 61 6C 20  .......Original 
    0098F810   53 74 72 69  6E 67 00 00  00 00 00 00  00 00 00 00  String..........
    

    …to “Short String” and pad the difference in string lengths using spaces (0x20) :

    0098F800   00 00 00 00  00 00 00 53  68 6F 72 74  20 53 74 72  .......Short Str
    0098F810   69 6E 67 20  20 20 00 00  00 00 00 00  00 00 00 00  ing   ..........
    

    This has some obvious problems. First, translated strings need to be of equal our smaller length compared to the original. What if we want to encode “Much Longer String” ?

    0098F800   00 00 00 00  00 00 00 4D  75 63 68 20  4C 6F 6E 67  .......Much Long
    0098F810   65 72 20 53  74 72 00 00  00 00 00 00  00 00 00 00  er Str..........
    

    It won’t fit. The second problem pertains to character set limitations. If the font in use was only designed for ASCII, it’s going to be inadequate for expressing nearly any other language.

    So a better approach is needed.

    Understanding The Data Structures
    An alternative to the approach outlined above is to understand the game’s resources so they can be modified at a deeper level. Here’s a model to motivate this investigation :


    Model of the game resource archive model
    Model of the game resource archive format

    This is a very common layout for such formats : there is a file header, a sequence of resource blocks, and a trailing index which describes the locations and types of the foregoing blocks.

    What use is understanding the data structures ? In doing so, it becomes possible to write new utilities that disassemble the data into individual pieces, modify the necessary pieces, and then reassemble them into a form that the original game engine likes.

    It’s important to take a careful, experimental approach to this since mistakes can be ruthlessly difficult to debug (unless you relish the thought of debugging the control flow through an opaque DOS executable). Thus, the very first goal in all of this is to create a program that can disassemble and reassemble the resource, thus creating an identical resource file. This diagram illustrates this complex initial process :


    Rewriting the game resource file
    Rewriting the game resource file

    So, yeah, this is one of the most complicated “copy file” operations that I can possibly code. But it forms an important basis, since the next step is to carefully replace one piece at a time.


    Modifying a specific game resource
    Modifying a specific game resource

    This diagram shows a simplistic model of a resource block that contains a series of message strings. The header contains pointers to each of the strings within the block. Instead of copying this particular resource block directly to the new file, a proposed modification utility will intercept it and rewrite the entire thing, writing new strings of arbitrary length and creating an adjusted header which will correctly point to the start of each new string. Thus, translated strings can be longer than the original strings.

    Further Work
    Exploiting this same approach, we can intercept and modify other game resources including fonts, images, and anything else that might need to be translated. I will explore specific examples in a later blog post.

    Followup