Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (109)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (8348)

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

  • Past duration 0.750206 too large when capturing my screen

    2 avril 2018, par it_is_a_literature

    I want to capture my screen with ffmpeg

    xrandr
    Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
    ffmpeg -f x11grab -framerate 30 -threads 0 -s 1920 x 1080 -i :0 /tmp/capture.mp4

    Error info :

    [x11grab @ 0x556025373ae0] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Past duration 0.750206 too large     435kB time=00:00:01.00 bitrate=3564.5kbits/s dup=19 drop=0 speed=0.382x    
    Past duration 0.749168 too large

    Try other ffmpeg command.

    ffmpeg -f x11grab -video_size 1360x768 -framerate 30 -i :0.0 -f pulse -i default -preset ultrafast -crf 18 -pix_fmt yuv420p out.mkv

    [x11grab @ 0x55db2f72fc00] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
    [pulse @ 0x55db2f7374e0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
    [output stream 0:1 @ 0x55db2f7784e0] 100 buffers queued in output stream 0:1, something may be wrong.
    [libvorbis @ 0x55db2f753720] Queue input is backward in time
    [matroska @ 0x55db2f750760] Non-monotonous DTS in output stream 0:1; previous: 3411, current: 3272; changing to 3411. This may result in incorrect timestamps in the output file.

    How to fix it ?

  • mp4 plays only sound but no video on ios

    5 avril 2018, par Chen

    I have a video that I get from a third party provide in my App, I want to play using react-native-video. It works fine on simulator, but on a real iphone 7 it has only sound but no video.

    After further research I found, when I try to airdrop/move via itunes the video to my iphone. It shows something like the following :

    enter image description here

    I have checked the codec with ffprobe and here is the output.
    ```

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bad.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42mp41
       creation_time   : 2018-03-28T21:30:13.000000Z
     Duration: 00:00:45.55, start: 0.000000, bitrate: 1373 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 1042 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
       Metadata:
         creation_time   : 2018-03-28T21:30:13.000000Z
         handler_name    : Alias Data Handler
         encoder         : AVC Coding
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
       Metadata:
         creation_time   : 2018-03-28T21:30:13.000000Z
         handler_name    : Alias Data Handler
    [STREAM]
    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=1001/60000
    codec_tag_string=avc1
    codec_tag=0x31637661
    width=1920
    height=1080
    coded_width=1920
    coded_height=1080
    has_b_frames=1
    sample_aspect_ratio=1:1
    display_aspect_ratio=16:9
    pix_fmt=yuv420p
    level=41
    color_range=tv
    color_space=bt709
    color_transfer=bt709
    color_primaries=bt709
    chroma_location=left
    field_order=unknown
    timecode=N/A
    refs=1
    is_avc=true
    nal_length_size=4
    id=N/A
    r_frame_rate=30000/1001
    avg_frame_rate=30000/1001
    time_base=1/30000
    start_pts=0
    start_time=0.000000
    duration_ts=1365364
    duration=45.512133
    bit_rate=1042237
    max_bit_rate=N/A
    bits_per_raw_sample=8
    nb_frames=1364
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=1
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    TAG:creation_time=2018-03-28T21:30:13.000000Z
    TAG:language=eng
    TAG:handler_name=Alias Data Handler
    TAG:encoder=AVC Coding
    [/STREAM]
    [STREAM]
    index=1
    codec_name=aac
    codec_long_name=AAC (Advanced Audio Coding)
    profile=LC
    codec_type=audio
    codec_time_base=1/48000
    codec_tag_string=mp4a
    codec_tag=0x6134706d
    sample_fmt=fltp
    sample_rate=48000
    channels=2
    channel_layout=stereo
    bits_per_sample=0
    id=N/A
    r_frame_rate=0/0
    avg_frame_rate=0/0
    time_base=1/48000
    start_pts=0
    start_time=0.000000
    duration_ts=2184582
    duration=45.512125
    bit_rate=317375
    max_bit_rate=458625
    bits_per_raw_sample=N/A
    nb_frames=2135
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=1
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    TAG:creation_time=2018-03-28T21:30:13.000000Z
    TAG:language=eng
    TAG:handler_name=Alias Data Handler
    [/STREAM]

    Then I tried VLC on iOS the video played without problem (it has both video and sound), except at the beginning it shows a grey pixel screen.

    enter image description here

    Next, what i did was using ffmpeg to re-encode the video stream via :

    ffmpeg -i bad.mp4 -c:a copy new.mp4

    After this new.mp4 plays with no problem.
    This is really confusing as the codec does not change and both videos works with no problem on my Mac.

    I have tried to play around with the b_frames, profile level on the new video to reproduce the problem but with no luck.

    I really do not want to process every video via ffmpeg after get it from the third party. Just wondering what might be the problem with the video ?