Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (45)

  • 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

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

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

  • FFMPEG error when saving NDI stream to mp4

    22 septembre 2020, par user1163234

    I am trying to record a NDI stream to a MP4 file(I want to stream the mp4 to rtmp endpoint after saving file). However I am getting this error when running this class. https://github.com/WalkerKnapp/devolay/blob/master/examples/src/main/java/com/walker/devolayexamples/recording/RecordingExample.java

    


    Error :

    


    Connecting to source: DESKTOP-GQNH46Q (Ari PC output)
[file @ 0x7fb4f2d48540] Setting default whitelist 'file,crypto'
x265 [info]: HEVC encoder version 0.0
x265 [info]: build info [Mac OS X][clang 8.1.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(12 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 1 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=4 deblock sao
[SWR @ 0x7fb4f8893000] Using fltp internally between filters
[mp4 @ 0x7fb4f3820200] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 135 >= 107
Failed to write video flush packet, skipping: Invalid argument
configurationVersion:                1
general_profile_space:               0
general_tier_flag:                   0
general_profile_idc:                 1
general_profile_compatibility_flags: 0x60000000
general_constraint_indicator_flags:  0x900000000000
general_level_idc:                   93
min_spatial_segmentation_idc:        0
parallelismType:                     0
chromaFormat:                        1
bitDepthLumaMinus8:                  0
bitDepthChromaMinus8:                0
avgFrameRate:                        0
constantFrameRate:                   0
numTemporalLayers:                   1
temporalIdNested:                    1
lengthSizeMinusOne:                  3
numOfArrays:                         4
array_completeness[0]:               0
NAL_unit_type[0]:                    32
numNalus[0]:                         1
nalUnitLength[0][0]:                 24
array_completeness[1]:               0
NAL_unit_type[1]:                    33
numNalus[1]:                         1
nalUnitLength[1][0]:                 41
array_completeness[2]:               0
NAL_unit_type[2]:                    34
numNalus[2]:                         1
nalUnitLength[2][0]:                 7
array_completeness[3]:               0
NAL_unit_type[3]:                    39
numNalus[3]:                         1
nalUnitLength[3][0]:                 2050
[AVIOContext @ 0x7fb4f2d48640] Statistics: 2 seeks, 4 writeouts
x265 [info]: frame I:      1, Avg QP:14.03  kb/s: 16.33   
x265 [info]: frame P:     36, Avg QP:21.67  kb/s: 0.04    
x265 [info]: frame B:     73, Avg QP:24.22  kb/s: 0.03    
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 28.9% 13.2% 18.4% 2.6% 36.8% 

encoded 110 frames in 15.13s (7.27 fps), 0.18 kb/s, Avg QP:23.29
[aac @ 0x7fb4f6aa6200] Qavg: 65536.000


    


  • ffmpeg API : handle frame loss in hevc encoding

    8 janvier 2024, par Mario

    Everything works fine until the introduction of frame->pts increment due to frame loss.

    


    Below is the regular progression without frame->pts increments :

    


    


    frame->pts=8 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    
frame->pts=9 pkt->pts=2560 pkt->dts=0 pkt->flags=0
    
frame->pts=10 pkt->pts=1536 pkt->dts=512 pkt->flags=0
    
frame->pts=11 pkt->pts=1024 pkt->dts=1024 pkt->flags=0
    
frame->pts=12 pkt->pts=2048 pkt->dts=1536 pkt->flags=0
    
frame->pts=13 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    
frame->pts=14 pkt->pts=3584 pkt->dts=2560 pkt->flags=0
    
frame->pts=15 pkt->pts=3072 pkt->dts=3072 pkt->flags=0
    
frame->pts=16 pkt->pts=4096 pkt->dts=3584 pkt->flags=0
    
frame->pts=17 pkt->pts=6656 pkt->dts=4096 pkt->flags=0
    
frame->pts=18 pkt->pts=5632 pkt->dts=4608 pkt->flags=0

    


    


    When I introduce the frame->pts increment it happens :

    


    


    frame->pts=15 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    
frame->pts=17 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    
frame->pts=19 pkt->pts=2560 pkt->dts=1536 pkt->flags=0
    
[mp4 @ 0x7eff842222c0] Application provided invalid, non monotonically increasing dts to muxer in stream 0 : 2048 >= 1536

    


    


    So I wrote the following code as a "quick" solution (between av_packet_rescale_ts() and av_interleaved_write_frame()) :

    


       av_packet_rescale_ts(pkt, c->time_base, st->time_base);  
   ...
   if (pkt->dts<=previous_dts)  
     {  
      if (pkt->pts<=previous_pts)  
        {  
         pkt->pts=previous_dts+1+pkt->pts-pkt->dts;  
        }  
       pkt->dts=previous_dts+1;  
     }  
   previous_dts=pkt->dts;  
   previous_pts=pkt->pts;  
   ...
   ret = av_interleaved_write_frame(fmt_ctx, pkt);  


    


    Now I no longer have the error, but the values are :

    


    


    frame->pts=15 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    
changed frame->pts=15 pkt->pts=512 pkt->dts=1 pkt->flags=1
    
frame->pts=17 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    
frame->pts=19 pkt->pts=2560 pkt->dts=1536 pkt->flags=0
    
changed frame->pts=19 pkt->pts=3073 pkt->dts=2049 pkt->flags=0
    
frame->pts=21 pkt->pts=1536 pkt->dts=1536 pkt->flags=0
    
changed frame->pts=21 pkt->pts=2050 pkt->dts=2050 pkt->flags=0
    
frame->pts=23 pkt->pts=4096 pkt->dts=3584 pkt->flags=0
    
frame->pts=25 pkt->pts=8704 pkt->dts=6144 pkt->flags=0
    
frame->pts=27 pkt->pts=6656 pkt->dts=5632 pkt->flags=0
    
changed frame->pts=27 pkt->pts=7169 pkt->dts=6145 pkt->flags=0
    
frame->pts=29 pkt->pts=5632 pkt->dts=5632 pkt->flags=0
    
changed frame->pts=29 pkt->pts=6146 pkt->dts=6146 pkt->flags=0
    
frame->pts=31 pkt->pts=7680 pkt->dts=7168 pkt->flags=0
    
frame->pts=33 pkt->pts=12800 pkt->dts=10240 pkt->flags=0
    
frame->pts=35 pkt->pts=10752 pkt->dts=9728 pkt->flags=0
    
changed frame->pts=35 pkt->pts=11265 pkt->dts=10241 pkt->flags=0
    
frame->pts=37 pkt->pts=9728 pkt->dts=9728 pkt->flags=0
    
changed frame->pts=37 pkt->pts=10242 pkt->dts=10242 pkt->flags=0

    


    


    What is the correct way to handle frame loss scenario ?
Is there a way to inform the encoder about frame loss ?

    


    The encoder is "hevc_qsv" and the output format is mov (.mp4).

    


  • How to get the first audio channel from a video with ffmpeg-python ?

    31 mai 2022, par gisk

    I would like to get the very first audio channel from a video using ffmpeg-python.

    


    I tried with this :

    


      out, _ = (
        ffmpeg
            .input(filename)
            .output('pipe:', loglevel=0, format='s16le', acodec='pcm_s16le', ac=1, ar='8k')
            .run(capture_stdout=True)
    )
    """ extract audio signal """
    self.signal = (
        np
            .frombuffer(out, np.int16)  
    )


    


    but I am not sure whether this is correct.

    


    I had a look here, but I could not find a solution : https://trac.ffmpeg.org/wiki/AudioChannelManipulation

    


    Any suggestion ? Thanks !

    


    EDIT :

    


    I tried @rotem solution and it seems to work. However, I have another issue which seems related to the -ac flag. For some videos, the numpy output has the right length (i.e., it matches the original audio length). For others, I get a wrong one. However, if I set -ac to 2 for these videos, I get the correct signal length. Do you know why is this happening ?

    


    This is the metadata of the video (duration : 2 minutes and 11 seconds) which outputs the correct numpy array size with setting -ac to 2

    


    '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_tag_string' : 'avc1', 'codec_tag' : '0x31637661', 'width' : 1920, 'height' : 1080, 'coded_width' : 1920, 'coded_height' : 1080, 'closed_captions' : 0, 'film_grain' : 0, 'has_b_frames' : 0, 'pix_fmt' : 'yuv420p', 'level' : 40, 'color_range' : 'tv', 'color_space' : 'bt709', 'color_transfer' : 'bt709', 'color_primaries' : 'bt709', 'chroma_location' : 'left', 'field_order' : 'progressive', 'refs' : 1, 'is_avc' : 'true', 'nal_length_size' : '4', 'id' : '0x1', 'r_frame_rate' : '30/1', 'avg_frame_rate' : '176805000/5894849', 'time_base' : '1/90000', 'start_pts' : 0, 'start_time' : '0.000000', 'duration_ts' : 11789698, 'duration' : '130.996644', 'bit_rate' : '16999840', 'bits_per_raw_sample' : '8', 'nb_frames' : '3929', 'extradata_size' : 34, 'disposition' : 'default' : 1, 'dub' : 0, 'original' : 0, 'comment' : 0, 'lyrics' : 0, 'karaoke' : 0, 'forced' : 0, 'hearing_impaired' : 0, 'visual_impaired' : 0, 'clean_effects' : 0, 'attached_pic' : 0, 'timed_thumbnails' : 0, 'captions' : 0, 'descriptions' : 0, 'metadata' : 0, 'dependent' : 0, 'still_image' : 0, 'tags' : 'creation_time' : '2022-05-30T15:00:39.000000Z', 'language' : 'eng', 'handler_name' : 'VideoHandle', 'vendor_id' : '[0][0][0][0]', 'index' : 1, 'codec_name' : 'aac', 'codec_long_name' : 'AAC (Advanced Audio Coding)', 'profile' : 'LC', 'codec_type' : 'audio', 'codec_tag_string' : 'mp4a', 'codec_tag' : '0x6134706d', 'sample_fmt' : 'fltp', 'sample_rate' : '48000', 'channels' : 2, 'channel_layout' : 'stereo', 'bits_per_sample' : 0, 'id' : '0x2', 'r_frame_rate' : '0/0', 'avg_frame_rate' : '0/0', 'time_base' : '1/48000', 'start_pts' : 696, 'start_time' : '0.014500', 'duration_ts' : 6285214, 'duration' : '130.941958', 'bit_rate' : '256004', 'nb_frames' : '6138', 'extradata_size' : 2, 'disposition' : 'default' : 1, 'dub' : 0, 'original' : 0, 'comment' : 0, 'lyrics' : 0, 'karaoke' : 0, 'forced' : 0, 'hearing_impaired' : 0, 'visual_impaired' : 0, 'clean_effects' : 0, 'attached_pic' : 0, 'timed_thumbnails' : 0, 'captions' : 0, 'descriptions' : 0, 'metadata' : 0, 'dependent' : 0, 'still_image' : 0, 'tags' : 'creation_time' : '2022-05-30T15:00:39.000000Z', 'language' : 'eng', 'handler_name' : 'SoundHandle', 'vendor_id' : '[0][0][0][0]'], 'format' : 'filename' : 'videos4/test_01.mp4', 'nb_streams' : 2, 'nb_programs' : 0, 'format_name' : 'mov,mp4,m4a,3gp,3g2,mj2', 'format_long_name' : 'QuickTime / MOV', 'start_time' : '0.000000', 'duration' : '130.996600', 'size' : '282621379', 'bit_rate' : '17259768', 'probe_score' : 100, 'tags' : 'major_brand' : 'mp42', 'minor_version' : '0', 'compatible_brands' : 'isommp42', 'creation_time' : '2022-05-30T15:00:39.000000Z', 'com.android.version' : '12', 'com.android.capture.fps' : '30.000000'.

    


    This is instead, the metadata of the video (duration 5 minutes) which gives the right result length with setting -ac to 1 :

    


    '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_tag_string' : 'avc1', 'codec_tag' : '0x31637661', 'width' : 1920, 'height' : 1080, 'coded_width' : 1920, 'coded_height' : 1080, 'closed_captions' : 0, 'film_grain' : 0, 'has_b_frames' : 0, 'sample_aspect_ratio' : '1:1', 'display_aspect_ratio' : '16:9', 'pix_fmt' : 'yuv420p', 'level' : 40, 'field_order' : 'progressive', 'refs' : 1, 'is_avc' : 'true', 'nal_length_size' : '4', 'id' : '0x1', 'r_frame_rate' : '30/1', 'avg_frame_rate' : '33862500/1128779', 'time_base' : '1/90000', 'start_pts' : 0, 'start_time' : '0.000000', 'duration_ts' : 27090696, 'duration' : '301.007733', 'bit_rate' : '16999542', 'bits_per_raw_sample' : '8', 'nb_frames' : '9030', 'extradata_size' : 26, 'disposition' : 'default' : 1, 'dub' : 0, 'original' : 0, 'comment' : 0, 'lyrics' : 0, 'karaoke' : 0, 'forced' : 0, 'hearing_impaired' : 0, 'visual_impaired' : 0, 'clean_effects' : 0, 'attached_pic' : 0, 'timed_thumbnails' : 0, 'captions' : 0, 'descriptions' : 0, 'metadata' : 0, 'dependent' : 0, 'still_image' : 0, 'tags' : 'language' : 'und', 'handler_name' : 'VideoHandler', 'vendor_id' : '[0][0][0][0]', 'side_data_list' : ['side_data_type' : 'Display Matrix', 'displaymatrix' : '\n00000000 : 0 65536 0\n00000001 : -65536 0 0\n00000002 : 0 0 1073741824\n', 'rotation' : -90], 'index' : 1, 'codec_name' : 'aac', 'codec_long_name' : 'AAC (Advanced Audio Coding)', 'profile' : 'LC', 'codec_type' : 'audio', 'codec_tag_string' : 'mp4a', 'codec_tag' : '0x6134706d', 'sample_fmt' : 'fltp', 'sample_rate' : '48000', 'channels' : 2, 'channel_layout' : 'stereo', 'bits_per_sample' : 0, 'id' : '0x2', 'r_frame_rate' : '0/0', 'avg_frame_rate' : '0/0', 'time_base' : '1/48000', 'start_pts' : 0, 'start_time' : '0.000000', 'duration_ts' : 14448640, 'duration' : '301.013333', 'bit_rate' : '256000', 'nb_frames' : '14110', 'extradata_size' : 2, 'disposition' : 'default' : 1, 'dub' : 0, 'original' : 0, 'comment' : 0, 'lyrics' : 0, 'karaoke' : 0, 'forced' : 0, 'hearing_impaired' : 0, 'visual_impaired' : 0, 'clean_effects' : 0, 'attached_pic' : 0, 'timed_thumbnails' : 0, 'captions' : 0, 'descriptions' : 0, 'metadata' : 0, 'dependent' : 0, 'still_image' : 0, 'tags' : 'language' : 'und', 'handler_name' : 'SoundHandler', 'vendor_id' : '[0][0][0][0]'], 'format' : 'filename' : 'videos4/video_02.mp4', 'nb_streams' : 2, 'nb_programs' : 0, 'format_name' : 'mov,mp4,m4a,3gp,3g2,mj2', 'format_long_name' : 'QuickTime / MOV', 'start_time' : '0.000000', 'duration' : '301.014000', 'size' : '649577064', 'bit_rate' : '17263703', 'probe_score' : 100, 'tags' : 'major_brand' : 'isom', 'minor_version' : '512', 'compatible_brands' : 'isomiso2avc1mp41', 'encoder' : 'Lavf58.27.103'