Advanced search

Medias (91)

Other articles (112)

  • Le profil des utilisateurs

    12 April 2011, by

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 November 2010, by

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 May 2011, by

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

On other websites (11173)

  • ffmpeg copyts to preserve timestamp

    13 April 2015, by Bala

    I am trying to modify an HLS segment transport stream, and preserve its start time with ffmpeg. However the output does not preserve the input file’s start_time value, even if -copyts is mentioned. Here’s my command line:

    ffmpeg  -i fileSequence1.ts -i x.png -filter_complex '[0:v][1:v]overlay[out]' -map '[out]' -map 0:1 -acodec copy -vsync 0 -vcodec libx264 -streamid 0:257 -streamid 1:258 -copyts -profile:v baseline -level 3 output.ts

    The start_time value is delayed about 2 seconds consistently.

    /Users/macadmin/>ffmpeg -y -v verbose -i fileSequence0.ts -map 0:0 -vcodec libx264 -copyts -vsync 0 -async 0 output.ts
    ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
     built on Mar 29 2015 21:31:57 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-nonfree --enable-vda
     libavutil      54. 15.100 / 54. 15.100
     libavcodec     56. 13.100 / 56. 13.100
     libavformat    56. 15.102 / 56. 15.102
     libavdevice    56.  3.100 / 56.  3.100
     libavfilter     5.  2.103 /  5.  2.103
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  3.100 / 53.  3.100
    [h264 @ 0x7fa93b800000] Current profile doesn't provide more RBSP data in PPS, skipping
       Last message repeated 2 times
    [mpegts @ 0x7fa93a80da00] max_analyze_duration 5000000 reached at 5000000 microseconds
    Input #0, mpegts, from 'fileSequence0.ts':
     Duration: 00:00:09.65, start: 9.952111, bitrate: 412 kb/s
     Program 1
       Stream #0:0[0x101]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360 (640x368), 25 fps, 25 tbr, 90k tbn, 50 tbc
       Stream #0:1[0x102]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 101 kb/s
    [graph 0 input from stream 0:0 @ 0x7fa93a5229c0] w:640 h:360 pixfmt:yuv420p tb:1/90000 fr:25/1 sar:0/1 sws_param:flags=2
    [libx264 @ 0x7fa93b800c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0x7fa93b800c00] profile High, level 3.0
    [mpegts @ 0x7fa93b800600] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to 'output.ts':
     Metadata:
       encoder         : Lavf56.15.102
       Stream #0:0: Video: h264 (libx264), yuv420p, 640x360, q=-1--1, 25 fps, 90k tbn, 25 tbc
       Metadata:
         encoder         : Lavc56.13.100 libx264
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [NULL @ 0x7fa93b800000] Current profile doesn't provide more RBSP data in PPS, skipping
       Last message repeated 1 times
    frame=   87 fps=0.0 q=28.0 size=      91kB time=00:00:11.40 bitrate=  65.0kbits/[NULL @ 0x7fa93b800000] Current profile doesn't provide more RBSP data in PPS, skipping
    frame=  152 fps=151 q=28.0 size=     204kB time=00:00:14.00 bitrate= 119.4kbits/[NULL @ 0x7fa93b800000] Current profile doesn't provide more RBSP data in PPS, skipping
    frame=  224 fps=148 q=28.0 size=     306kB time=00:00:16.88 bitrate= 148.5kbits/No more output streams to write to, finishing.
    frame=  240 fps=125 q=-1.0 Lsize=     392kB time=00:00:19.52 bitrate= 164.6kbits/s    
    video:334kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 17.347548%
    Input file #0 (fileSequence0.ts):
     Input stream #0:0 (video): 240 packets read (360450 bytes); 240 frames decoded;
     Input stream #0:1 (audio): 0 packets read (0 bytes);
     Total: 240 packets (360450 bytes) demuxed
    Output file #0 (output.ts):
     Output stream #0:0 (video): 240 frames encoded; 240 packets muxed (342204 bytes);
     Total: 240 packets (342204 bytes) muxed
    [libx264 @ 0x7fa93b800c00] frame I:3     Avg QP:15.08  size:  7856
    [libx264 @ 0x7fa93b800c00] frame P:81    Avg QP:21.03  size:  2807
    [libx264 @ 0x7fa93b800c00] frame B:156   Avg QP:23.40  size:   585
    [libx264 @ 0x7fa93b800c00] consecutive B-frames: 11.7%  2.5%  7.5% 78.3%
    [libx264 @ 0x7fa93b800c00] mb I  I16..4: 57.4% 17.5% 25.1%
    [libx264 @ 0x7fa93b800c00] mb P  I16..4:  8.0%  8.2%  1.0%  P16..4: 30.5% 11.3%  4.6%  0.0%  0.0%    skip:36.4%
    [libx264 @ 0x7fa93b800c00] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 34.6%  2.7%  0.2%  direct: 1.3%  skip:60.9%  L0:47.3% L1:49.1% BI: 3.6%
    [libx264 @ 0x7fa93b800c00] 8x8 transform intra:42.2% inter:73.3%
    [libx264 @ 0x7fa93b800c00] coded y,uvDC,uvAC intra: 26.2% 43.0% 6.8% inter: 5.4% 8.5% 0.1%
    [libx264 @ 0x7fa93b800c00] i16 v,h,dc,p: 46% 26%  6% 21%
    [libx264 @ 0x7fa93b800c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 50% 14% 23%  1%  2%  6%  1%  3%  1%
    [libx264 @ 0x7fa93b800c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 32% 10%  3%  3%  4%  2%  5%  2%
    [libx264 @ 0x7fa93b800c00] i8c dc,h,v,p: 48% 23% 26%  3%
    [libx264 @ 0x7fa93b800c00] Weighted P-Frames: Y:1.2% UV:0.0%
    [libx264 @ 0x7fa93b800c00] ref P L0: 71.5% 10.7% 14.8%  2.9%  0.1%
    [libx264 @ 0x7fa93b800c00] ref B L0: 95.5%  4.0%  0.5%
    [libx264 @ 0x7fa93b800c00] ref B L1: 96.8%  3.2%
    [libx264 @ 0x7fa93b800c00] kb/s:285.17

    ----------- FFProbe source video
    /Users/macadmin>ffprobe fileSequence0.ts
    ffprobe version 2.5.3 Copyright (c) 2007-2015 the FFmpeg developers
     built on Mar 29 2015 21:31:57 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-nonfree --enable-vda
     libavutil      54. 15.100 / 54. 15.100
     libavcodec     56. 13.100 / 56. 13.100
     libavformat    56. 15.102 / 56. 15.102
     libavdevice    56.  3.100 / 56.  3.100
     libavfilter     5.  2.103 /  5.  2.103
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  3.100 / 53.  3.100
    Input #0, mpegts, from 'fileSequence0.ts':
     Duration: 00:00:09.65, start: 9.952111, bitrate: 412 kb/s
     Program 1
       Stream #0:0[0x101]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360, 25 fps, 25 tbr, 90k tbn, 50 tbc
       Stream #0:1[0x102]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 101 kb/s

    ------ FFPROBE result video
    /Users/macadmin>ffprobe output.ts
    ffprobe version 2.5.3 Copyright (c) 2007-2015 the FFmpeg developers
     built on Mar 29 2015 21:31:57 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-nonfree --enable-vda
     libavutil      54. 15.100 / 54. 15.100
     libavcodec     56. 13.100 / 56. 13.100
     libavformat    56. 15.102 / 56. 15.102
     libavdevice    56.  3.100 / 56.  3.100
     libavfilter     5.  2.103 /  5.  2.103
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  3.100 / 53.  3.100
    Input #0, mpegts, from 'output.ts':
     Duration: 00:00:09.60, start: 11.400000, bitrate: 334 kb/s
     Program 1
       Metadata:
         service_name    : Service01
         service_provider: FFmpeg
       Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 640x360, 25 fps, 25 tbr, 90k tbn, 50 tbc

    How do I ensure that output file has the same start_time? Thanks.

  • Output RTSP stream with ffmpeg

    28 July 2015, by sipwiz

    I’m attempting to use the ffmpeg libraries to send a video stream from my application to a media server (in this case wowza). I have been able to do the reverse and consume an RTSP stream but I’m having a few issues writing an RTSP stream.

    I have found a few examples and attempted to utilise the relevant bits. The code is below. I have simplified it as much as I can. I do only want to send a single H264 bit stream to the wowza server and which it can handle.

    I get an "Integer division by zero" exception whenever in the av_interleaved_write_frame function when I try and send a packet. The exception looks like it’s related to the packet timestamps not being set correctly. I’ve tried different values and can get past the exception by setting some contrived values but then the write call fails.

    #include <iostream>
    #include <fstream>
    #include <sstream>
    #include <cstring>

    #include "stdafx.h"
    #include "windows.h"

    extern "C"
    {
       #include
       #include
       #include
       #include
    }

    using namespace std;

    static int video_is_eof;

    #define STREAM_DURATION   50.0
    #define STREAM_FRAME_RATE 25 /* 25 images/s */
    #define STREAM_PIX_FMT    AV_PIX_FMT_YUV420P /* default pix_fmt */
    #define VIDEO_CODEC_ID CODEC_ID_H264

    static int sws_flags = SWS_BICUBIC;

    /* video output */
    static AVFrame *frame;
    static AVPicture src_picture, dst_picture;
    static int frame_count;

    static int write_frame(AVFormatContext *fmt_ctx, const AVRational *time_base, AVStream *st, AVPacket *pkt)
    {
       /* rescale output packet timestamp values from codec to stream timebase */
       pkt->pts = av_rescale_q_rnd(pkt->pts, *time_base, st->time_base, AVRounding(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
       pkt->dts = av_rescale_q_rnd(pkt->dts, *time_base, st->time_base, AVRounding(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
       pkt->duration = av_rescale_q(pkt->duration, *time_base, st->time_base);

       pkt->stream_index = st->index;

       // Exception occurs here.
       return av_interleaved_write_frame(fmt_ctx, pkt);
    }

    /* Add an output stream. */
    static AVStream *add_stream(AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id)
    {
       AVCodecContext *c;
       AVStream *st;

       /* find the encoder */
       *codec = avcodec_find_encoder(codec_id);
       if (!(*codec)) {
           fprintf(stderr, "Could not find encoder for '%s'\n", avcodec_get_name(codec_id));
           exit(1);
       }

       st = avformat_new_stream(oc, *codec);
       if (!st) {
           fprintf(stderr, "Could not allocate stream\n");
           exit(1);
       }

       st->id = oc->nb_streams - 1;
       c = st->codec;
       c->codec_id = codec_id;
       c->bit_rate = 400000;
       c->width = 352;
       c->height = 288;
       c->time_base.den = STREAM_FRAME_RATE;
       c->time_base.num = 1;
       c->gop_size = 12; /* emit one intra frame every twelve frames at most */
       c->pix_fmt = STREAM_PIX_FMT;

       return st;
    }

    static void open_video(AVFormatContext *oc, AVCodec *codec, AVStream *st)
    {
       int ret;
       AVCodecContext *c = st->codec;

       /* open the codec */
       ret = avcodec_open2(c, codec, NULL);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not open video codec: ");
           exit(1);
       }

       /* allocate and init a re-usable frame */
       frame = av_frame_alloc();
       if (!frame) {
           fprintf(stderr, "Could not allocate video frame\n");
           exit(1);
       }
       frame->format = c->pix_fmt;
       frame->width = c->width;
       frame->height = c->height;

       /* Allocate the encoded raw picture. */
       ret = avpicture_alloc(&amp;dst_picture, c->pix_fmt, c->width, c->height);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not allocate picture: ");
           exit(1);
       }

       /* copy data and linesize picture pointers to frame */
       *((AVPicture *)frame) = dst_picture;
    }

    /* Prepare a dummy image. */
    static void fill_yuv_image(AVPicture *pict, int frame_index, int width, int height)
    {
       int x, y, i;

       i = frame_index;

       /* Y */
       for (y = 0; y &lt; height; y++)
           for (x = 0; x &lt; width; x++)
               pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3;

       /* Cb and Cr */
       for (y = 0; y &lt; height / 2; y++) {
           for (x = 0; x &lt; width / 2; x++) {
               pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2;
               pict->data[2][y * pict->linesize[2] + x] = 64 + x + i * 5;
           }
       }
    }

    static void write_video_frame(AVFormatContext *oc, AVStream *st, int flush)
    {
       int ret;
       AVCodecContext *c = st->codec;

       if (!flush) {
           fill_yuv_image(&amp;dst_picture, frame_count, c->width, c->height);
       }

       AVPacket pkt = { 0 };
       int got_packet;
       av_init_packet(&amp;pkt);

       /* encode the image */
       frame->pts = frame_count;
       ret = avcodec_encode_video2(c, &amp;pkt, flush ? NULL : frame, &amp;got_packet);
       if (ret &lt; 0) {
           fprintf(stderr, "Error encoding video frame:");
           exit(1);
       }
       /* If size is zero, it means the image was buffered. */

       if (got_packet) {
           ret = write_frame(oc, &amp;c->time_base, st, &amp;pkt);
       }
       else {
           if (flush) {
               video_is_eof = 1;
           }
           ret = 0;
       }

       if (ret &lt; 0) {
           fprintf(stderr, "Error while writing video frame: ");
           exit(1);
       }
       frame_count++;
    }

    static void close_video(AVFormatContext *oc, AVStream *st)
    {
       avcodec_close(st->codec);
       av_free(src_picture.data[0]);
       av_free(dst_picture.data[0]);
       av_frame_free(&amp;frame);
    }

    int _tmain(int argc, _TCHAR* argv[])
    {
       printf("starting...\n");

       const char *filename = "rtsp://test:password@192.168.33.19:1935/ffmpeg/0";

       AVOutputFormat *fmt;
       AVFormatContext *oc;
       AVStream *video_st;
       AVCodec *video_codec;
       double video_time;
       int flush, ret;

       /* Initialize libavcodec, and register all codecs and formats. */
       av_register_all();
       avformat_network_init();

       AVOutputFormat* oFmt = av_oformat_next(NULL);
       while (oFmt) {
           if (oFmt->video_codec == VIDEO_CODEC_ID) {
               break;
           }
           oFmt = av_oformat_next(oFmt);
       }

       if (!oFmt) {
           printf("Could not find the required output format.\n");
           exit(1);
       }

       /* allocate the output media context */
       avformat_alloc_output_context2(&amp;oc, oFmt, "rtsp", filename);

       if (!oc) {
           printf("Could not set the output media context.\n");
           exit(1);
       }

       fmt = oc->oformat;
       if (!fmt) {
           printf("Could not create the output format.\n");
           exit(1);
       }

       video_st = NULL;

       cout &lt;&lt; "Codec = " &lt;&lt; avcodec_get_name(fmt->video_codec) &lt;&lt; endl;
       if (fmt->video_codec != AV_CODEC_ID_NONE)
       {
           video_st = add_stream(oc, &amp;video_codec, fmt->video_codec);
       }

       /* Now that all the parameters are set, we can open the video codec and allocate the necessary encode buffers. */
       if (video_st) {
           open_video(oc, video_codec, video_st);
       }

       av_dump_format(oc, 0, filename, 1);
       char errorBuff[80];

       if (!(fmt->flags &amp; AVFMT_NOFILE)) {
           ret = avio_open(&amp;oc->pb, filename, AVIO_FLAG_WRITE);
           if (ret &lt; 0) {
               fprintf(stderr, "Could not open outfile '%s': %s", filename, av_make_error_string(errorBuff, 80, ret));
               return 1;
           }
       }

       flush = 0;
       while (video_st &amp;&amp; !video_is_eof) {
           /* Compute current video time. */
           video_time = (video_st &amp;&amp; !video_is_eof) ? video_st->pts.val * av_q2d(video_st->time_base) : INFINITY;

           if (!flush &amp;&amp; (!video_st || video_time >= STREAM_DURATION)) {
               flush = 1;
           }

           if (video_st &amp;&amp; !video_is_eof) {
               write_video_frame(oc, video_st, flush);
           }
       }

       if (video_st) {
           close_video(oc, video_st);
       }

       if ((fmt->flags &amp; AVFMT_NOFILE)) {
           avio_close(oc->pb);
       }

       avformat_free_context(oc);

       printf("finished.\n");

       getchar();

       return 0;
    }
    </cstring></sstream></fstream></iostream>

    Does anyone have any insights about how the packet timestamps can be successfully set?

  • Issue when combining 2 video files [after matching the specs]

    6 December 2015, by Rune

    Basically I got a .mp4 and a .flv file which I want to concatenate (the .mp4 should be the intro).

    So after having asked a previous question regarding this I went ahead and converted the intro video to an .flv with matching specifications of the second video.

    First I got the specifications of the second (.flv) video using ffprobe. This was the output:

    {
       "streams": [
           {
               "index": 0,
               "codec_name": "h264",
               "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
               "profile": "High",
               "codec_type": "video",
               "codec_time_base": "1/50",
               "codec_tag_string": "[0][0][0][0]",
               "codec_tag": "0x0000",
               "width": 646,
               "height": 364,
               "coded_width": 656,
               "coded_height": 368,
               "has_b_frames": 2,
               "sample_aspect_ratio": "1:1",
               "display_aspect_ratio": "323:182",
               "pix_fmt": "yuv420p",
               "level": 30,
               "chroma_location": "left",
               "refs": 5,
               "is_avc": "true",
               "nal_length_size": "4",
               "r_frame_rate": "25/1",
               "avg_frame_rate": "25/1",
               "time_base": "1/1000",
               "start_pts": 80,
               "start_time": "0.080000",
               "bit_rate": "400000",
               "bits_per_raw_sample": "8",
               "disposition": {
                   "default": 0,
                   "dub": 0,
                   "original": 0,
                   "comment": 0,
                   "lyrics": 0,
                   "karaoke": 0,
                   "forced": 0,
                   "hearing_impaired": 0,
                   "visual_impaired": 0,
                   "clean_effects": 0,
                   "attached_pic": 0
               }
           },
           {
               "index": 1,
               "codec_name": "aac",
               "codec_long_name": "AAC (Advanced Audio Coding)",
               "profile": "LC",
               "codec_type": "audio",
               "codec_time_base": "1/44100",
               "codec_tag_string": "[0][0][0][0]",
               "codec_tag": "0x0000",
               "sample_fmt": "fltp",
               "sample_rate": "44100",
               "channels": 2,
               "channel_layout": "stereo",
               "bits_per_sample": 0,
               "r_frame_rate": "0/0",
               "avg_frame_rate": "0/0",
               "time_base": "1/1000",
               "start_pts": 241,
               "start_time": "0.241000",
               "bit_rate": "96000",
               "disposition": {
                   "default": 0,
                   "dub": 0,
                   "original": 0,
                   "comment": 0,
                   "lyrics": 0,
                   "karaoke": 0,
                   "forced": 0,
                   "hearing_impaired": 0,
                   "visual_impaired": 0,
                   "clean_effects": 0,
                   "attached_pic": 0
               }
           }
       ],
       "format": {
           "filename": "vid2.flv",
           "nb_streams": 2,
           "nb_programs": 0,
           "format_name": "flv",
           "format_long_name": "FLV (Flash Video)",
           "start_time": "0.080000",
           "duration": "371.920000",
           "size": "23876671",
           "bit_rate": "513587",
           "probe_score": 100,
           "tags": {
               "audiosize": "4476626",
               "canSeekToEnd": "true",
               "datasize": "23876671",
               "videosize": "19004263",
               "hasAudio": "true",
               "hasCuePoints": "false",
               "hasKeyframes": "true",
               "hasMetadata": "true",
               "hasVideo": "true",
               "lasttimestamp": "372",
               "metadatacreator": "flvtool++ (Facebook, Motion project, dweatherford)",
               "totalframes": "9298",
               "encoder": "Lavf56.36.100"
           }
       }
    }

    Here’s my command:

    -i prefix.mp4 -b:v 400k -b:a 96k -r 25 -ar 44100 -acodec aac -vf scale=646:364 -strict -2 prefix.flv.

    This produces the following output (as well as the video file):

    ffmpeg version N-76137-gb0bb1dc Copyright (c) 2000-2015 the FFmpeg developers
     built with gcc 5.2.0 (GCC)
     configuration: --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      55.  4.100 / 55.  4.100
     libavcodec     57.  7.100 / 57.  7.100
     libavformat    57.  8.102 / 57.  8.102
     libavdevice    57.  0.100 / 57.  0.100
     libavfilter     6. 12.100 /  6. 12.100
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.100 /  2.  0.100
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'prefix.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.8.102
     Duration: 00:00:05.31, start: 0.000000, bitrate: 1589 kb/s
       Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1205 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Output #0, flv, to 'prefix.flv':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.8.102
       Stream #0:0(und): Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 646x364 [SAR 2912:2907 DAR 16:9], q=2-31, 400 kb/s, 25 fps, 1k tbn, 25 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc57.7.100 flv
       Stream #0:1(und): Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, 5.1, fltp, 96 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.7.100 aac
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    frame=   79 fps=0.0 q=10.7 size=     381kB time=00:00:03.43 bitrate= 908.7kbits/frame=  132 fps=0.0 q=10.1 Lsize=     548kB time=00:00:05.31 bitrate= 844.1kbits/s
    video:479kB audio:62kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.161623%
    [aac @ 0000021aa893eae0] Qavg: 177.292

    I then run the outputted video file and it runs just like the old one.

    I then concatenate the ouputted intro file with my main video file using the following command (tmp.txt contains the 2 files):

    -f concat -i tmp.txt -c copy newvid.flv

    This produces the following output:

    ffmpeg version N-76137-gb0bb1dc Copyright (c) 2000-2015 the FFmpeg developers
     built with gcc 5.2.0 (GCC)
     configuration: --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      55.  4.100 / 55.  4.100
     libavcodec     57.  7.100 / 57.  7.100
     libavformat    57.  8.102 / 57.  8.102
     libavdevice    57.  0.100 / 57.  0.100
     libavfilter     6. 12.100 /  6. 12.100
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.100 /  2.  0.100
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, concat, from 'tmp.txt':
     Duration: N/A, start: 0.000000, bitrate: 496 kb/s
       Stream #0:0: Video: flv1, yuv420p, 646x364, 400 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
       Stream #0:1: Audio: aac (LC), 44100 Hz, 5.1, fltp, 96 kb/s
    [flv @ 00000257b5f0e180] Codec for stream 0 does not use global headers but container format requires global headers
    [flv @ 00000257b5f0e180] Codec for stream 1 does not use global headers but container format requires global headers
    Output #0, flv, to 'newvid.flv':
     Metadata:
       encoder         : Lavf57.8.102
       Stream #0:0: Video: flv1 ([2][0][0][0] / 0x0002), yuv420p, 646x364, q=2-31, 400 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
       Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, 5.1, 96 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [flv @ 00000257b56947e0] Packet mismatch 486539264 7424
    [flv @ 00000257b56947e0] Auto-inserting h264_mp4toannexb bitstream filter
    [flv @ 00000257b5f0e180] Non-monotonous DTS in output stream 0:0; previous: 5263, current: 5255; changing to 5263. This may result in incorrect timestamps in the output file.
    frame= 6359 fps=0.0 q=-1.0 size=   15906kB time=00:04:14.30 bitrate= 512.4kbits/frame= 9428 fps=0.0 q=-1.0 Lsize=   23835kB time=00:06:17.05 bitrate= 517.8kbits/s
    video:19016kB audio:4403kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.777447%

    When I try to run the final video (newvid.flv) it plays like this:

    It starts off playing the intro just fine.
    However, when the intro is finished the video freezes while the sound of the actual video continues for the entire duration of the video.

    Thus in conclusion what is lacking is the video of the second vid (the audio is fine).

    I’m new at using ffmpeg but I’ve tried my best to solve this, which is why I’m asking for your help.

    I’d certainly appreciate if someone could help me out.