Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (52)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Possibilité de déploiement en ferme

    12 avril 2011, par

    MediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
    Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)

Sur d’autres sites (4945)

  • ffmpeg issues "501 Not Implemented" while recording an RTSP stream

    28 février 2019, par atsushi

    I have a 4K camera (Sony SNC-VB770) streaming RTSP.

    I’m trying to record the stream into files (each has handy length, say, 1hour)
    using a simple script to repeatedly launch ffmpeg (ver 4.1) :

    while : ; do
     # (set $url and $outfile, and then)
     ffmpeg -rtsp_transport tcp -t 3600 -y -i $url -c copy -map 0:0 -b:v 16000k $outfile
    done

    If I run the script on a local PC directly connected to the camera, it works (longer than a week, at least).
    However, if I do the same on a server machine located in a data center, it fails randomly with no error message.
    Sometimes it runs for a few days, sometimes it dies in one minutes.

    Typical output looks like the following :

    # devname: snc-vb770
    # url: rtsp://10.40.35.90/media/video1
    # vb: 16000k
    # datefmt %d%H
    # addtimestamp 0
    no timestamp
    ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
     configuration: --prefix=/usr/local/ffmpeg-4.1 --enable-openssl --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libx264 --enable-libvorbis --enable-filter=drawtext --enable-libfreetype --enable-libfribidi --enable-fontconfig
     libavutil      56. 22.100 / 56. 22.100
     libavcodec     58. 35.100 / 58. 35.100
     libavformat    58. 20.100 / 58. 20.100
     libavdevice    58.  5.100 / 58.  5.100
     libavfilter     7. 40.101 /  7. 40.101
     libswscale      5.  3.100 /  5.  3.100
     libswresample   3.  3.100 /  3.  3.100
     libpostproc    55.  3.100 / 55.  3.100
    Input #0, rtsp, from 'rtsp://10.40.35.90/media/video1':
     Metadata:
       title           : Sony RTSP Server
     Duration: N/A, start: 0.066667, bitrate: N/A
       Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 14.99 fps, 14.99 tbr, 90k tbn, 29.97 tbc
    Output #0, mp4, to './2811.mp4':
     Metadata:
       title           : Sony RTSP Server
       encoder         : Lavf58.20.100
       Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 16000 kb/s, 14.99 fps, 14.99 tbr, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    [mp4 @ 0x24e4ec0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    [mp4 @ 0x24e4ec0] pts has no value
    [mp4 @ 0x24e4ec0] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
    frame=   33 fps=0.0 q=-1.0 size=    1792kB time=00:00:02.00 bitrate=7332.9kbits/s speed=3.57x
    ...
    frame=  104 fps=8.4 q=-1.0 Lsize=    6532kB time=00:00:06.74 bitrate=7939.6kbits/s speed=0.548x
    video:6531kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.023506%

    I’ve looked into RTSP packet and found an "RTSP/1.0 501 Not Implemented" is sent from ffmpeg to the camera.
    After that the camera eventually sent back "RTSP/1.0 505 RTSP Version not supported" and then ffmpeg quits shortly.

    The "501" packet seems to be generated by libavformat/rtsp.c:ff_rtsp_read_reply(),
    when ffmpeg receive a malformed RTSP packet with method=(null), status_code=0.
    I don’t know why such packets arrive at random timing and who is wrong (maybe the camera, maybe any of network switches or routers in the middle of the network path from the camera to the server machine).
    But anyway, I don’t want the recording to be stopped
    due to those malformed packets.

    Is there any workaround to make ffmpeg ignore invalid RTSP packets and just continue the recording ?

    Additional information :

    • I’ve tested the recording with both ffmpeg ver4.1 and 2.8.4 and no difference observed.

    • No difference observed at lower resolution nor at lower bitrate.

    • I have 3 cameras from various manufacturers in the same network environment.
      All of the three are working without problem for more than a month.
      Only the Sony SNC-VB770 shows the strange behavior.

  • How do I fix the "PES packet size mismatch" error in FFmpeg ?

    8 février 2021, par Ed999

    How to fix the error PES packet size mismatch in FFmpeg -

    



    I'm going to answer my own question, because the phrase PES packet size mismatch comes up regularly in posts relating to ffmpeg, but I've nowhere seen a satisfactory solution to it.

    



    It usually figures in a problem involving .TS transport stream files : either in relation to concatenating such files, or relating to re-muxing them (from .ts to .mp4). Somewhere in the output from ffmpeg, the deadly phrase packet size mismatch will suddenly start repeating.

    



    A solution is to concatenate them as .ts files (i.e. in their original format), then take the output .ts file, split it into a video file (.ts) and an audio file (.ts), then remux them (to either .ts or .mp4) using the "itsoffset" option. Even if stream copy is used, outputting to .mp4 will often give worse picture quality than retaining the .ts format.

    



    The following code does that, outputting either .mp4 video or .ts video (copy the code into a simple .bat batch file, then run that file) -

    



    .

    



    :: Program Location
SET ffmpeg="C:\Program Files\FFmpeg\ffmpeg.exe" -hide_banner  


::  STEP 1 -

::  Create File List
IF EXIST mylist.txt DEL mylist.txt
FOR %%i IN (*.ts) DO ECHO file '%%i'>> mylist.txt

::  Concatenate Files : TS
%ffmpeg%  -f concat  -safe 0  -i mylist.txt  -c copy  -threads 1  out.ts


::  STEP 2 -

::  Extract Video stream
%ffmpeg%  -i out.ts  -vcodec copy  -an  -sn  -threads 1  video.ts

::  Extract Audio stream
%ffmpeg%  -i out.ts  -acodec copy  -vn  -sn  -threads 1  audio.ts


::  STEP 3 -

::  Combine Video and Audio streams (with .MP4 options)
SET mapping=-i video.ts -itsoffset -0  -i audio.ts   -map 0:v -map 1:a
SET options=-flags global_header  -movflags faststart  -threads 1
%ffmpeg%  %mapping%  -c:v copy -c:a copy  %options%  output.mp4

::  Combine Video and Audio streams (with .TS options)
SET mapping=-i video.ts -itsoffset -0  -i audio.ts  -map 0:v -map 1:a
SET options=-threads 1
%ffmpeg%  %mapping%  -c:v copy -c:a copy  %options%  output.ts


    



    .

    



    Addendum :

    



    There seems to be some dispute about my suggested solution, as detailed in the Comments below. It seems to be being said that my solution is ignoring the fact that data is missing in the source files.

    



    I think the least I can do is admit that since ffmpeg is reporting an error in the source files, with its 'packet size mismatch' warning, the objection raised in the Comments might be valid.

    



    However, even if data is missing, my suggested routine will at least give you a file which will play in most media players. In many cases, there will not even be an audible or visual fault at the join point specified in the reported error.

    



    It's difficult to see how the missing data might be restored, but do please chip in with suggestions. There must be scope for improving my script, because so little attention has been paid to this type of fault previously.

    



    Happily, it seems that this type of error will NOT cause the sound to lose synchronisation with the picture. So the audio after the join-point will not go out-of-sync, even if some data is missing at the join.

    


  • How to segment a video file (using FFMPEG) to "encoded" version (i.e., .mp4 is downloaded from one our CDN servers) in which each chunk must be 4MB ?

    13 janvier 2019, par Danyal Zia

    I am using FFMPEG command-line/terminal tool. I have a video in .mp4 format. I am well educated on the segmentation of videos in terms of length/duration, however, I want to segment the chunks of the "encoded/transcoded" version of the video (which I downloaded from our CDN in.mp4) to 4MB (4000000 Bytes), except the last one, which will vary in size (i.e., to encode/decode the video fully). If I am having trouble explaining what I am seeking, then just know I have no interest in segmenting the video in terms of duration/length, as this is irrelevant for me.

    To explain the scenario : I have two copies of the same video. The one is "original" and the second video is the one that I downloaded from the server/CDN. The second video turns out to be corrupted (despite the fact that the video is downloaded successfully, and has the same length/duration) ; it stops playing around 1:12 minutes, even though the seeker/slider keeps progressing until somewhere around 1:45 minutes where the video and audio start to work again.

    I have done the binary comparison (using "fc" in CMD) of these two videos, and they are not the same at all.

    In a nutshell : I think I need to "encode" the corrupted .mp4 video, and then segment the encoded data to multiple versions of 4MB. I don’t know how can I do it from FFMPEG.

    If anything isn’t clear, then ask as many questions you want.

    Thank you for reading !

    Edit : The following seems to work, however, not all the chunks are equivalent to 4MB. What is a something I am doing the wrong way ?

    ffmpeg -i "original.mp4" -b:v 1000000 -g 60 -hls_time 2 -hls
    _list_size 0 -hls_segment_size 4000000 output.m3u8