Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (38)

  • 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

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

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

Sur d’autres sites (7558)

  • Getting this error in next js 13 app router “Module not found : Can't resolve './lib-cov/fluent-ffmpeg'”

    14 novembre 2023, par Aamir Khan

    I want to convert mp4 to mp3 using the npm package 'fluent-ffmpeg’, in the express application it is working fine but not in NextJS 13, And even after removing the node_modules folder, package-lock.js and doing "npm install" again, it still didn't work. Does anyone have a solution for this ?

    


    This error is coming in the console.

    


    > my-app@0.1.0 dev&#xA;> next dev&#xA;&#xA;   ▲ Next.js 14.0.2&#xA;   - Local:        http://localhost:3000&#xA;   - Environments: .env.local&#xA;&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA; ✓ Ready in 2.2s&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA; ⨯ ./node_modules/fluent-ffmpeg/index.js:1:48&#xA;Module not found: Can&#x27;t resolve &#x27;./lib-cov/fluent-ffmpeg&#x27;&#xA;&#xA;https://nextjs.org/docs/messages/module-not-found&#xA;&#xA;Import trace for requested module:&#xA;./src/app/api/new/route.js&#xA; ○ Compiling /not-found ...&#xA;(node:3236) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.&#xA;(Use `node --trace-deprecation ...` to show where the warning was created)&#xA; ⨯ ./node_modules/fluent-ffmpeg/index.js:1:48&#xA;Module not found: Can&#x27;t resolve &#x27;./lib-cov/fluent-ffmpeg&#x27;&#xA;&#xA;https://nextjs.org/docs/messages/module-not-found&#xA;&#xA;Import trace for requested module:&#xA;./src/app/api/new/route.js&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA; ⨯ ./node_modules/fluent-ffmpeg/index.js:1:48&#xA;Module not found: Can&#x27;t resolve &#x27;./lib-cov/fluent-ffmpeg&#x27;&#xA;&#xA;https://nextjs.org/docs/messages/module-not-found&#xA;&#xA;Import trace for requested module:&#xA;./src/app/api/new/route.js&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;</w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w>

    &#xA;

    I also tried creating the webpack.config.js file in the root directory of the project but it did not work

    &#xA;

    &lt;

    &#xA;

    import webpack from &#x27;webpack&#x27;&#xA;&#xA;module.exports = {&#xA;  plugins: [&#xA;    new webpack.DefinePlugin({&#xA;      &#x27;process.env.FLUENTFFMPEG_COV&#x27;: JSON.stringify(false),&#xA;    }),&#xA;  ],&#xA;};&#xA;

    &#xA;

    >

    &#xA;

    This is my src/app/api/new/route.js file code

    &#xA;

    import { NextResponse, NextRequest } from "next/server";&#xA;import ffmpeg from &#x27;fluent-ffmpeg&#x27;&#xA;var command = ffmpeg()&#xA;&#xA;export function GET(){&#xA;&#xA;    command.input(&#x27;mp4/video.mp4&#x27;)&#xA;    &#xA;    .save(&#x27;converted/audio.mp3&#x27;)&#xA;&#xA;    return NextResponse.json(&#x27;Done&#x27;)&#xA;}&#xA;

    &#xA;

    This is next.config.js file

    &#xA;

    /** @type {import(&#x27;next&#x27;).NextConfig} */&#xA;&#xA;const nextConfig = {}&#xA;&#xA;module.exports = nextConfig&#xA;

    &#xA;

    This is package.js file

    &#xA;

    {&#xA;  "name": "my-app",&#xA;  "version": "0.1.0",&#xA;  "private": true,&#xA;  "scripts": {&#xA;    "dev": "next dev",&#xA;    "build": "next build",&#xA;    "start": "next start",&#xA;    "lint": "next lint"&#xA;  },&#xA;  "dependencies": {&#xA;    "ffmpeg": "^0.0.4",&#xA;    "fluent-ffmpeg": "^2.1.2",&#xA;    "next": "14.0.2",&#xA;    "react": "^18",&#xA;    "react-dom": "^18",&#xA;    "webpack": "^5.89.0"&#xA;  }&#xA;}&#xA;

    &#xA;

    How to fix this error ?

    &#xA;

  • Reverse Engineering Italian Literature

    1er juillet 2014, par Multimedia Mike — Reverse Engineering

    Some time ago, Diego “Flameeyes” Pettenò tried his hand at reverse engineering a set of really old CD-ROMs containing even older Italian literature. The goal of this RE endeavor would be to extract the useful literature along with any structural metadata (chapters, etc.) and convert it to a more open format suitable for publication at, e.g., Project Gutenberg or Archive.org.

    Unfortunately, the structure of the data thwarted the more simplistic analysis attempts (like inspecting for blocks of textual data). This will require deeper RE techniques. Further frustrating the effort, however, is the fact that the binaries that implement the reading program are written for the now-archaic Windows 3.1 operating system.

    In pursuit of this RE goal, I recently thought of a way to glean more intelligence using DOSBox.

    Prior Work
    There are 6 discs in the full set (distributed along with 6 sequential issues of a print magazine named L’Espresso). Analysis of the contents of the various discs reveals that many of the files are the same on each disc. It was straightforward to identify the set of files which are unique on each disc. This set of files all end with the extension “LZn”, where n = 1..6 depending on the disc number. Further, the root directory of each disc has a file indicating the sequence number (1..6) of the CD. Obviously, these are the interesting targets.

    The LZ file extensions stand out to an individual skilled in the art of compression– could it be a variation of the venerable LZ compression ? That’s actually unlikely because LZ — also seen as LIZ — stands for Letteratura Italiana Zanichelli (Zanichelli’s Italian Literature).

    The Unix ‘file’ command was of limited utility, unable to plausibly identify any of the files.

    Progress was stalled.

    Saying Hello To An Old Frenemy
    I have been showing this screenshot to younger coworkers to see if any of them recognize it :


    DOSBox running Window 3.1

    Not a single one has seen it before. Senior computer citizen status : Confirmed.

    I recently watched an Ancient DOS Games video about Windows 3.1 games. This episode showed Windows 3.1 running under DOSBox. I had heard this was possible but that it took a little work to get running. I had a hunch that someone else had probably already done the hard stuff so I took to the BitTorrent networks and quickly found a download that had the goods ready to go– a directory of Windows 3.1 files that just had to be dropped into a DOSBox directory and they would be ready to run.

    Aside : Running OS software procured from a BitTorrent network ? Isn’t that an insane security nightmare ? I’m not too worried since it effectively runs under a sandboxed virtual machine, courtesy of DOSBox. I suppose there’s the risk of trojan’d OS software infecting binaries that eventually leave the sandbox.

    Using DOSBox Like ‘strace’
    strace is a tool available on some Unix systems, including Linux, which is able to monitor the system calls that a program makes. In reverse engineering contexts, it can be useful to monitor an opaque, binary program to see the names of the files it opens and how many bytes it reads, and from which locations. I have written examples of this before (wow, almost 10 years ago to the day ; now I feel old for the second time in this post).

    Here’s the pitch : Make DOSBox perform as strace in order to serve as a platform for reverse engineering Windows 3.1 applications. I formed a mental model about how DOSBox operates — abstracted file system classes with methods for opening and reading files — and then jumped into the source code. Sure enough, the code was exactly as I suspected and a few strategic print statements gave me the data I was looking for.

    Eventually, I even took to running DOSBox under the GNU Debugger (GDB). This hasn’t proven especially useful yet, but it has led to an absurd level of nesting :


    GDB runs DOSBox runs Windows 3.1

    The target application runs under Windows 3.1, which is running under DOSBox, which is running under GDB. This led to a crazy situation in which DOSBox had the mouse focus when a GDB breakpoint was triggered. At this point, DOSBox had all desktop input focus and couldn’t surrender it because it wasn’t running. I had no way to interact with the Linux desktop and had to reboot the computer. The next time, I took care to only use the keyboard to navigate the application and trigger the breakpoint and not allow DOSBox to consume the mouse focus.

    New Intelligence

    By instrumenting the local file class (virtual HD files) and the ISO file class (CD-ROM files), I was able to watch which programs and dynamic libraries are loaded and which data files the code cares about. I was able to narrow down the fact that the most interesting programs are called LEGGENDO.EXE (‘reading’) and LEGGENDA.EXE (‘legend’ ; this has been a great Italian lesson as well as RE puzzle). The first calls the latter, which displays this view of the data we are trying to get at :


    LIZ: Authors index

    When first run, the program takes an interest in a file called DBBIBLIO (‘database library’, I suspect) :

    === Read(’LIZ98\DBBIBLIO.LZ1’) : req 337 bytes ; read 337 bytes from pos 0x0
    === Read(’LIZ98\DBBIBLIO.LZ1’) : req 337 bytes ; read 337 bytes from pos 0x151
    === Read(’LIZ98\DBBIBLIO.LZ1’) : req 337 bytes ; read 337 bytes from pos 0x2A2
    [...]
    

    While we were unable to sort out all of the data files in our cursory investigation, a few things were obvious. The structure of this file looked to contain 336-byte records. Turns out I was off by 1– the records are actually 337 bytes each. The count of records read from disc is equal to the number of items shown in the UI.

    Next, the program is interested in a few more files :

    *** isoFile() : ’DEPOSITO\BLOKCTC.LZ1’, offset 0x27D6000, 2911488 bytes large
    === Read(’DEPOSITO\BLOKCTC.LZ1’) : req 96 bytes ; read 96 bytes from pos 0x0
    *** isoFile() : ’DEPOSITO\BLOKCTX0.LZ1’, offset 0x2A9D000, 17152 bytes large
    === Read(’DEPOSITO\BLOKCTX0.LZ1’) : req 128 bytes ; read 128 bytes from pos 0x0
    === Seek(’DEPOSITO\BLOKCTX0.LZ1’) : seek 384 (0x180) bytes, type 0
    === Read(’DEPOSITO\BLOKCTX0.LZ1’) : req 256 bytes ; read 256 bytes from pos 0x180
    === Seek(’DEPOSITO\BLOKCTC.LZ1’) : seek 1152 (0x480) bytes, type 0
    === Read(’DEPOSITO\BLOKCTC.LZ1’) : req 32 bytes ; read 32 bytes from pos 0x480
    === Read(’DEPOSITO\BLOKCTC.LZ1’) : req 1504 bytes ; read 1504 bytes from pos 0x4A0
    [...]

    Eventually, it becomes obvious that BLOKCTC has the juicy meat. There are 32-byte records followed by variable-length encoded text sections. Since there is no text to be found in these files, the text is either compressed, encrypted, or both. Some rough counting (the program seems to disable copy/paste, which thwarts more precise counting), indicates that the text size is larger than the data chunks being read from disc, so compression seems likely. Encryption isn’t out of the question (especially since the program deems it necessary to disable copy and pasting of this public domain literary data), and if it’s in use, that means the key is being read from one of these files.

    Blocked On Disassembly
    So I’m a bit blocked right now. I know exactly where the data lives, but it’s clear that I need to reverse engineer some binary code. The big problem is that I have no idea how to disassemble Windows 3.1 binaries. These are NE-type executable files. Disassemblers abound for MZ files (MS-DOS executables) and PE files (executables for Windows 95 and beyond). NE files get no respect. It’s difficult (but not impossible) to even find data about the format anymore, and details are incomplete. It should be noted, however, the DOSBox-as-strace method described here lends insight into how Windows 3.1 processes NE-type EXEs. You can’t get any more authoritative than that.

    So far, I have tried the freeware version of IDA Pro. Unfortunately, I haven’t been able to get the program to work on my Windows machine for a long time. Even if I could, I can’t find any evidence that it actually supports NE files (the free version specifically mentions MZ and PE, but does not mention NE or LE).

    I found an old copy of Borland’s beloved Turbo Assembler and Debugger package. It has Turbo Debugger for Windows, both regular and 32-bit versions. Unfortunately, the normal version just hangs Windows 3.1 in DOSBox. The 32-bit Turbo Debugger loads just fine but can’t load the NE file.

    I’ve also wondered if DOSBox contains any advanced features for trapping program execution and disassembling. I haven’t looked too deeply into this yet.

    Future Work
    NE files seem to be the executable format that time forgot. I have a crazy brainstorm about repacking NE files as MZ executables so that they could be taken apart with an MZ disassembler. But this will take some experimenting.

    If anyone else has any ideas about ripping open these binaries, I would appreciate hearing them.

    And I guess I shouldn’t be too surprised to learn that all the literature in this corpus is already freely available and easily downloadable anyway. But you shouldn’t be too surprised if that doesn’t discourage me from trying to crack the format that’s keeping this particular copy of the data locked up.

  • RTSP client can not be play video

    13 novembre 2018, par Harshil Makwana

    I added and updated below API inside ffserver code inside ffmpeg code :

    AVPacket *dataPacket;
    void setAVPacket(AVPacket *packet)
    {
       if (packet &amp;&amp; packet->data)
       {
           pthread_mutex_lock(&amp;lock);
           if (isSend == 1)
           {
               dataPacket = packet;
           }
           else
           {
               if (packet != NULL)
               {
                   av_packet_unref(packet);
                   free(packet);
                   packet = NULL;
               }
           }
           pthread_mutex_unlock(&amp;lock);
       }


    static int http_prepare_data(HTTPContext *c)
    {
       int i, len, ret;
       AVFormatContext *ctx;

       av_freep(&amp;c->pb_buffer);
       switch(c->state) {
       case HTTPSTATE_SEND_DATA_HEADER:
           ctx = avformat_alloc_context();
           if (!ctx)
               return AVERROR(ENOMEM);
           c->pfmt_ctx = ctx;
           av_dict_copy(&amp;(c->pfmt_ctx->metadata), c->stream->metadata, 0);

           for(i=0;istream->nb_streams;i++) {
               LayeredAVStream *src;
               AVStream *st = avformat_new_stream(c->pfmt_ctx, NULL);
               if (!st)
                   return AVERROR(ENOMEM);

               /* if file or feed, then just take streams from FFServerStream
                * struct */
               if (!c->stream->feed ||
                   c->stream->feed == c->stream)
                   src = c->stream->streams[i];
               else
                   src = c->stream->feed->streams[c->stream->feed_streams[i]];

               unlayer_stream(c->pfmt_ctx->streams[i], src); //TODO we no longer copy st->internal, does this matter?
               av_assert0(!c->pfmt_ctx->streams[i]->priv_data);

               if (src->codec->flags &amp; AV_CODEC_FLAG_BITEXACT)
                   c->pfmt_ctx->flags |= AVFMT_FLAG_BITEXACT;
           }
           /* set output format parameters */
           c->pfmt_ctx->oformat = c->stream->fmt;
           av_assert0(c->pfmt_ctx->nb_streams == c->stream->nb_streams);

           c->got_key_frame = 0;

           /* prepare header and save header data in a stream */
           if (avio_open_dyn_buf(&amp;c->pfmt_ctx->pb) &lt; 0) {
               /* XXX: potential leak */
               return -1;
           }
           c->pfmt_ctx->pb->seekable = 0;

           /*
            * HACK to avoid MPEG-PS muxer to spit many underflow errors
            * Default value from FFmpeg
            * Try to set it using configuration option
            */
           c->pfmt_ctx->max_delay = (int)(0.7*AV_TIME_BASE);

           if ((ret = avformat_write_header(c->pfmt_ctx, NULL)) &lt; 0) {
               http_log("Error writing output header for stream '%s': %s\n",
                        c->stream->filename, av_err2str(ret));
               return ret;
           }
           av_dict_free(&amp;c->pfmt_ctx->metadata);

           len = avio_close_dyn_buf(c->pfmt_ctx->pb, &amp;c->pb_buffer);
           c->buffer_ptr = c->pb_buffer;
           c->buffer_end = c->pb_buffer + len;

           c->state = HTTPSTATE_SEND_DATA;
           c->last_packet_sent = 0;
           break;
       case HTTPSTATE_SEND_DATA:
           /* find a new packet */
           /* read a packet from the input stream */
           if (c->stream->feed)
               ffm_set_write_index(c->fmt_in,
                                   c->stream->feed->feed_write_index,
                                   c->stream->feed->feed_size);

           if (c->stream->max_time &amp;&amp;
               c->stream->max_time + c->start_time - cur_time &lt; 0)
               /* We have timed out */
               c->state = HTTPSTATE_SEND_DATA_TRAILER;
           else {
               AVPacket pkt;
           redo:
               ret = av_read_frame(c->fmt_in, &amp;pkt);
               if (ret &lt; 0) {
                   if (c->stream->feed) {
                       /* if coming from feed, it means we reached the end of the
                        * ffm file, so must wait for more data */
                       c->state = HTTPSTATE_WAIT_FEED;
                       return 1; /* state changed */
                   }
                   if (ret == AVERROR(EAGAIN)) {
                       /* input not ready, come back later */
                       return 0;
                   }
                   if (c->stream->loop) {
                       avformat_close_input(&amp;c->fmt_in);
                       if (open_input_stream(c, "") &lt; 0)
                           goto no_loop;
                       goto redo;
                   } else {
                       no_loop:
                           /* must send trailer now because EOF or error */
                           c->state = HTTPSTATE_SEND_DATA_TRAILER;
                   }
               } else {
                   int source_index = pkt.stream_index;
                   /* update first pts if needed */
                   if (c->first_pts == AV_NOPTS_VALUE &amp;&amp; pkt.dts != AV_NOPTS_VALUE) {
                       c->first_pts = av_rescale_q(pkt.dts, c->fmt_in->streams[pkt.stream_index]->time_base, AV_TIME_BASE_Q);
                       c->start_time = cur_time;
                   }
                   /* send it to the appropriate stream */
                   if (c->stream->feed) {
                       /* if coming from a feed, select the right stream */
                       if (c->switch_pending) {
                           c->switch_pending = 0;
                           for(i=0;istream->nb_streams;i++) {
                               if (c->switch_feed_streams[i] == pkt.stream_index)
                                   if (pkt.flags &amp; AV_PKT_FLAG_KEY)
                                       c->switch_feed_streams[i] = -1;
                               if (c->switch_feed_streams[i] >= 0)
                                   c->switch_pending = 1;
                           }
                       }
                       for(i=0;istream->nb_streams;i++) {
                           if (c->stream->feed_streams[i] == pkt.stream_index) {
                               AVStream *st = c->fmt_in->streams[source_index];
                               pkt.stream_index = i;
                               if (pkt.flags &amp; AV_PKT_FLAG_KEY &amp;&amp;
                                   (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
                                    c->stream->nb_streams == 1))
                                   c->got_key_frame = 1;
                               if (!c->stream->send_on_key || c->got_key_frame)
                                   goto send_it;
                           }
                       }
                   } else {
                       AVStream *ist, *ost;
                   send_it:
                       ist = c->fmt_in->streams[source_index];
                       /* specific handling for RTP: we use several
                        * output streams (one for each RTP connection).
                        * XXX: need more abstract handling */
                       if (c->is_packetized) {
                           /* compute send time and duration */
                           if (pkt.dts != AV_NOPTS_VALUE) {
                               c->cur_pts = av_rescale_q(pkt.dts, ist->time_base, AV_TIME_BASE_Q);
                               c->cur_pts -= c->first_pts;
                           }
                           c->cur_frame_duration = av_rescale_q(pkt.duration, ist->time_base, AV_TIME_BASE_Q);
                           /* find RTP context */
                           c->packet_stream_index = pkt.stream_index;
                           ctx = c->rtp_ctx[c->packet_stream_index];
                           if(!ctx) {
                               av_packet_unref(&amp;pkt);
                               break;
                           }
                           /* only one stream per RTP connection */
                           pkt.stream_index = 0;
                       } else {
                           ctx = c->pfmt_ctx;
                           /* Fudge here */
                       }

                       if (c->is_packetized) {
                           int max_packet_size;
                           if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP)
                               max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
                           else
                               max_packet_size = c->rtp_handles[c->packet_stream_index]->max_packet_size;
                           ret = ffio_open_dyn_packet_buf(&amp;ctx->pb,
                                                          max_packet_size);
                       } else
                           ret = avio_open_dyn_buf(&amp;ctx->pb);

                       if (ret &lt; 0) {
                           /* XXX: potential leak */
                           return -1;
                       }
                       ost = ctx->streams[pkt.stream_index];

                       ctx->pb->seekable = 0;
                       if (pkt.dts != AV_NOPTS_VALUE)
                           pkt.dts = av_rescale_q(pkt.dts, ist->time_base,
                                                  ost->time_base);
                       if (pkt.pts != AV_NOPTS_VALUE)
                           pkt.pts = av_rescale_q(pkt.pts, ist->time_base,
                                                  ost->time_base);
                       pkt.duration = av_rescale_q(pkt.duration, ist->time_base,
                                                   ost->time_base);
                       if ((ret = av_write_frame(ctx, &amp;pkt)) &lt; 0) {
                           http_log("Error writing frame to output for stream '%s': %s\n",
                                    c->stream->filename, av_err2str(ret));
                           c->state = HTTPSTATE_SEND_DATA_TRAILER;
                       }

                       av_freep(&amp;c->pb_buffer);
                       len = avio_close_dyn_buf(ctx->pb, &amp;c->pb_buffer);
                       ctx->pb = NULL;
                       c->cur_frame_bytes = len;
                       c->buffer_ptr = c->pb_buffer;
                       c->buffer_end = c->pb_buffer + len;

                       if (len == 0) {
                           av_packet_unref(&amp;pkt);
                           goto redo;
                       }
                   }
                   av_packet_unref(&amp;pkt);
               }
           }
           break;
       default:
       case HTTPSTATE_SEND_DATA_TRAILER:
           /* last packet test ? */
           if (c->last_packet_sent || c->is_packetized)
               return -1;
           ctx = c->pfmt_ctx;
           /* prepare header */
           if (avio_open_dyn_buf(&amp;ctx->pb) &lt; 0) {
               /* XXX: potential leak */
               return -1;
           }
           c->pfmt_ctx->pb->seekable = 0;
           av_write_trailer(ctx);
           len = avio_close_dyn_buf(ctx->pb, &amp;c->pb_buffer);
           c->buffer_ptr = c->pb_buffer;
           c->buffer_end = c->pb_buffer + len;

           c->last_packet_sent = 1;
           break;
       }
       return 0;
    }

    if you see here there is API named setAVPacket(), through which I am passing my H264 based encoded packet to RTSPServer. And same AVPacket used by Other function named http_prepare_data(), which will be called when PLAY request is coming.

    After implementing above code I can do handshake of RTSP and server can send RTP packet to client, but no player(tried VLC, ffplayer) can play video.

    Can you help me on this ?

    Very much thanks you in advance.