Recherche avancée

Médias (0)

Mot : - Tags -/inscription3

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (58)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (14752)

  • Adjust PTS and DTS before mp4 video creation

    17 mars 2018, par Cristiano

    I’m retrieving raw h264 compressed frames from usb camera to create an mp4 video. This is my simple code :

    for(int i = 0; i<120;i++)
    {
       AVPacket pkt;
       av_init_packet(&pkt);
       ret = av_read_frame(inputFormatCtx, &pkt);

       pkt.pts = pkt.dts = i;
       pkt.pts = av_rescale_q(pkt.pts, inputStream->time_base, outputStream->time_base);
       pkt.dts = av_rescale_q(pkt.dts, inputStream->time_base, outputStream->time_base);

       ret = av_interleaved_write_frame(outputFormatCtx, &pkt);
       av_packet_unref(&pkt);
    }
    ret = av_write_trailer(outputFormatCtx);

    This works well. Now I would like to store these AVPackets to create the video in a second moment.
    I changed my code in this way

    for(int i = 0; i<120;i++){
    AVPacket pkt;
    av_init_packet(&pkt);
    ret = av_read_frame(inputFormatCtx, &pkt);
    packets.push_back(pkt);
    }

    vector<avpacket>::reverse_iterator it;
    int j = 0;
    for(it = packets.rbegin(); it != packets.rend(); it++){
       AVPacket n = (*it);
       n.pts = n.dts = j;
       j++;
       n.pts = av_rescale_q(n.pts, inputStream->time_base, outputStream->time_base);
       n.dts = av_rescale_q(n.dts, inputStream->time_base, outputStream->time_base);
       ret = av_interleaved_write_frame(outputFormatCtx, &amp;n);
       av_packet_unref(&amp;n);
    }

    ret = av_write_trailer(outputFormatCtx);
    </avpacket>

    The resulting video is not so fluid and I used ffprobe to see more details.
    These are the first three frame generating with the first block of code.

    [FRAME]
    media_type=video
    stream_index=0
    key_frame=1
    pkt_pts=0
    pkt_pts_time=0.000000
    pkt_dts=0
    pkt_dts_time=0.000000
    best_effort_timestamp=0
    best_effort_timestamp_time=0.000000
    pkt_duration=512
    pkt_duration_time=0.033333
    pkt_pos=48
    pkt_size=12974
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=I
    coded_picture_number=0
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    [/FRAME]
    [FRAME]
    media_type=video
    stream_index=0
    key_frame=0
    pkt_pts=512
    pkt_pts_time=0.033333
    pkt_dts=512
    pkt_dts_time=0.033333
    best_effort_timestamp=512
    best_effort_timestamp_time=0.033333
    pkt_duration=512
    pkt_duration_time=0.033333
    pkt_pos=13022
    pkt_size=473
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=P
    coded_picture_number=1
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    [/FRAME]
    [FRAME]
    media_type=video
    stream_index=0
    key_frame=0
    pkt_pts=1024
    pkt_pts_time=0.066667
    pkt_dts=1024
    pkt_dts_time=0.066667
    best_effort_timestamp=1024
    best_effort_timestamp_time=0.066667
    pkt_duration=512
    pkt_duration_time=0.033333
    pkt_pos=13495
    pkt_size=511
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=P
    coded_picture_number=2
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    [/FRAME]

    While these are the same frames created using the second block of code.

    [FRAME]
    media_type=video
    stream_index=0
    key_frame=1
    pkt_pts=14848
    pkt_pts_time=0.966667
    pkt_dts=14848
    pkt_dts_time=0.966667
    best_effort_timestamp=14848
    best_effort_timestamp_time=0.966667
    pkt_duration=512
    pkt_duration_time=0.033333
    pkt_pos=757791
    pkt_size=65625
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=I
    coded_picture_number=58
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    [/FRAME]
    [FRAME]
    media_type=video
    stream_index=0
    key_frame=0
    pkt_pts=15360
    pkt_pts_time=1.000000
    pkt_dts=15360
    pkt_dts_time=1.000000
    best_effort_timestamp=15360
    best_effort_timestamp_time=1.000000
    pkt_duration=512
    pkt_duration_time=0.033333
    pkt_pos=823416
    pkt_size=29642
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=P
    coded_picture_number=60
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    [/FRAME]
    [FRAME]
    media_type=video
    stream_index=0
    key_frame=1
    pkt_pts=30208
    pkt_pts_time=1.966667
    pkt_dts=30208
    pkt_dts_time=1.966667
    best_effort_timestamp=30208
    best_effort_timestamp_time=1.966667
    pkt_duration=512
    pkt_duration_time=0.033333
    pkt_pos=1546454
    pkt_size=66021
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=I
    coded_picture_number=117
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    [/FRAME]

    I immediately noticed that pkt_pts_time and other fields are not starting from 0 and are not increasing linearly (respect to the 30 fps that I established). It is possible to obtain the same video writing the AVPackets in a second moment as I’m doing ? Thank you.

  • Does this FFMPEG command create videos compatible with ABR playback on video.js player ?

    16 mars 2018, par alchemical

    We’re working on a site that will allow users to upload videos. It then encodes these videos into 4 bitrates. The initial version just lets the user manually select which of the 4 version they would like to play. However, the final version should allow for adaptive bitrate ABR using video.js player. Ideally, we should not need to re-encode the videos again for them to stream with ABR.

    I’m trying to understand if the current FFMPEG statement will support ABR :

    -i \"0\" -i \"1\" -threads 5 -filter_complex \"
    [0:v]scale=-2 :2[bg] ;[1:v]scale=-2:40*2/1080[watermark_scaled] ;[bg]
    [watermark_scaled]overlay=x=main_w-overlay_w-(10*
    2/1080):10*2/1080\" -acodec copy -vcodec libx264 -b:v
    3 \"4\"

  • ffmpeg : concat and encode with one command

    15 mars 2018, par Massimo Vantaggio

    I have a script that automates encode and concat a series of input video files.
    I’m trying to get encode and concat in a single command.

    At the moment it does not work causing immense empty pauses in the final video output.

    I would like to get the result with concat demux instead of concat protocol because it is much harder to automate in a script

    Do you know if it is possible to archive this result with concat demux ?
    Thanks a lot !

    Massimo

    ENCODE / CONCAT 1080p

    for f in ./*.mp4; do echo "file '$f'" >> list.txt; done

    ffmpeg -f concat -safe 0 -y -i list.txt -i ../logo/logo.png -c:a aac -b:a 384k -ar 48000 -ac 2 -af aresample=async=1000 -c:v libx264 -x264opts keyint=50:min-keyint=50:no-scenecut -bf 0 -r 25 -b:v 4800k -maxrate 4800k -bufsize 3000k -profile:v main -crf 22 -filter_complex "[0:v][1:v]overlay=main_w-overlay_w-10:10,scale=1920:1080,setsar=1" ../buffer/1080set.mp4

    It seems to add long pause at low frame-rate :

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb03f05e600] Auto-inserting h264_mp4toannexb bitstream filter

    frame= 9745 fps= 13 q=27.0 size= 186368kB time=00:18:52.56 bitrate=1348.0kbits

    frame= 9745 fps= 13 q=27.0 size= 186368kB time=00:18:56.57 bitrate=1343.3kbits/

    frame= 9745 fps= 13 q=27.0 size= 186368kB time=00:19:00.65 bitrate=1338.5kbits/

    frame= 9745 fps= 13 q=27.0 size= 186368kB time=00:19:02.29 bitrate=1336.5kbits/

    More than 1000 frames duplicated

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       creation_time   : 2016-02-27T22:25:49.000000Z
       encoder         : HandBrake 0.10.5 2016021100
     Duration: 00:06:29.87, start: 0.000000, bitrate: 3447 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 768x432, 3282 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         creation_time   : 2016-02-27T22:25:49.000000Z
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
       Metadata:
         creation_time   : 2016-02-27T22:25:49.000000Z
         handler_name    : Stereo

    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '2.mp4':
     Metadata:
       major_brand     : M4V
       minor_version   : 1
       compatible_brands: M4V mp42isom
       creation_time   : 2016-02-27T18:52:37.000000Z
     Duration: 00:07:16.93, start: 0.000000, bitrate: 1184 kb/s
       Stream #1:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 768x432, 991 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
       Metadata:
         creation_time   : 2016-02-27T18:52:37.000000Z
         handler_name    : Mainconcept MP4 Video Media Handler
         encoder         : AVC Coding
       Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
       Metadata:
         creation_time   : 2016-02-27T18:52:37.000000Z
         handler_name    : Mainconcept MP4 Sound Media Handler

    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '3.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42mp41
       creation_time   : 2017-06-27T17:58:17.000000Z
     Duration: 00:05:05.05, start: 0.000000, bitrate: 2622 kb/s
       Stream #2:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 768x432, 2301 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
       Metadata:
         creation_time   : 2017-06-27T17:58:17.000000Z
         handler_name    : Alias Data Handler
         encoder         : AVC Coding
       Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
       Metadata:
         creation_time   : 2017-06-27T17:58:17.000000Z
         handler_name    : Alias Data Handler

    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '4.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42mp41
       creation_time   : 2017-06-27T17:53:32.000000Z
     Duration: 00:06:47.36, start: 0.000000, bitrate: 3144 kb/s
       Stream #3:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 768x432, 2819 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
       Metadata:
         creation_time   : 2017-06-27T17:53:32.000000Z
         handler_name    : Alias Data Handler
         encoder         : AVC Coding
       Stream #3:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
       Metadata:
         creation_time   : 2017-06-27T17:53:32.000000Z
         handler_name    : Alias Data Handler