Recherche avancée

Médias (0)

Mot : - Tags -/albums

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

Autres articles (84)

  • Le profil des utilisateurs

    12 avril 2011, par

    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 novembre 2010, par

    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 mai 2011, par

    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 (...)

Sur d’autres sites (6929)

  • How to burn in subtitles onto a webm video with ffmpeg ?

    7 mai 2014, par IcanFLY

    I am trying to set up a livestream with ffserver and ffmpeg. The problem is I am using webm, and I need to burn in subtitles, which are located in a mkv. I am not quite sure how to do this, but here is my ffmpeg config (ffstream.sh) that I am using :

    #Livestream script for FFMpeg/FFServer
    FPS=24                                          # Stream FPS.
    GOP=48                                          # GOP Should be double of FPS.
    THREADS=4                                       # How many threads.
    DEADLINE=realtime                               # Speed preset, realtime is fastest.
    FRAMELAG=16                                     # How many frames to seek ahead (max 25)
    QMAX=52                                         # More = less quality.
    QMIN=10                                         # Less = more quality.
    VBITRATE=1M                                     # Target Bitrate.
    BITRATE=3000k                                   # Bitrate.
    AUDIBR=48k                                      # Audio Bitrate.
    SERVER=<myserver>:8090/feed.ffm                 # Server stream endpoint.
    LOGLEVEL=verbose                                # Logging verbosity level.

    for f in $@; do ffmpeg -re -i $f\
           -vf subtitles=$f\
           -g $GOP -loglevel $LOGLEVEL\
           -c:v:0 libvpx  -threads $THREADS -b:v $BITRATE -vb $VBITRATE -bufsize $BITRATE\
           -qmax $QMAX -qmin $QMIN -deadline $DEADLINE -lag-in-frames $FRAMELAG\
           -c:a libvorbis -b:a $AUDIBR\
           "http://$SERVER"
    done
    </myserver>

    Everything connects fine and I can get audio and video to play, however I cannot seem to get the subtitles to show up. Here is my output (I quit out of it) :

    Stream mapping:
     Stream #0:1 -> #0:0 (flac -> libvorbis)
     Stream #0:0 -> #0:1 (h264 -> libvpx)
    Press [q] to stop, [?] for help
    [output stream 0:0 @ 0x1e77dc0] 100 buffers queued in output stream 0:0, something may be wrong.
    frame=  232 fps= 23 q=0.0 Lsize=     816kB time=00:00:09.67 bitrate= 690.8kbits/s
    video:758kB audio:41kB subtitle:0kB other streams:0kB global headers:3kB muxing overhead: 2.113806%
    Input file #0 (<file>.mkv):
     Input stream #0:0 (video): 242 packets read (3343775 bytes); 242 frames decoded;
     Input stream #0:1 (audio): 118 packets read (391060 bytes); 118 frames decoded (483328 samples);
     Input stream #0:2 (audio): 8 packets read (20480 bytes);
     Input stream #0:3 (subtitle): 1 packets read (182 bytes);
     Input stream #0:4 (subtitle): 1 packets read (52 bytes);
     Input stream #0:5 (attachment): 0 packets read (0 bytes);
     Total: 370 packets (3755549 bytes) demuxed
    Output file #0 (http://<myserver>/feed.ffm):
     Output stream #0:0 (audio): 3233 frames encoded (206912 samples); 406 packets muxed (41937 bytes);
     Output stream #0:1 (video): 232 frames encoded; 232 packets muxed (776350 bytes);
     Total: 638 packets (818287 bytes) muxed
    Received signal 2: terminating.
    </myserver></file>

    Also here is my ffserver config, not sure if there is something in here stopping the subtitles from showing up :

    Port 8090
    BindAddress 0.0.0.0
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 10000
    CustomLog -

    <feed>
       File /path/to/folder/tmp/feed.ffm
       FileMaxSize 100M
       #Allow localhost
       ACL allow 127.0.0.1
       ACL allow <myip>
       #It might be a good idea to add your stream source here.
    </myip></feed>


    <stream>
       Feed feed.ffm
       Format webm
       VideoSize hd720 #Must be set here, all input files will be scaled to fit.
       AVOptionVideo flags +global_header
       AVOptionAudio flags +global_header
       StartSendOnKey
    </stream>

    <stream>
       Format status
       ACL allow localhost
    </stream>

    # Redirect index.html to the appropriate site
    <redirect>
       URL http://<myserver>
    </myserver></redirect>

    Any help on how to do this, would be grateful.

  • PHP ffmpeg Image to Video

    2 mars 2021, par Metin Saraç

    I want to create a Video with Image in php ffmpeg.

    &#xA;

    My code is as follows,

    &#xA;

    $video = $ffmpeg->open(&#x27;image1.jpg&#x27;);&#xA;$video->filters() ->resize(new FFMpeg\Coordinate\Dimension(1080, 1080))->synchronize();&#xA;$format = new FFMpeg\Format\Video\X264();&#xA;$format->setKiloBitrate(1000)->setAudioChannels(2)->setAudioKiloBitrate(256);&#xA;$video->save($format, &#x27;video.avi&#x27;);&#xA;

    &#xA;

    I want total video duration and background sound to my code, but I couldn't find a suitable solution. Can you help me ?

    &#xA;

    Respects.

    &#xA;

  • .mp4 file is not playing in Django template and FireFox or Chrome

    9 février 2021, par Himanshu sharma

    I can save live RTSP video stream in .mp4 but when I run saved .mp4 video in Django template or Firefox or Chrome browser or VLC, video is not playing in ubuntu.&#xA;I think I have a compatible issue problem in .mp4. Furthermore, I want to show and play .mp4 saved file in Django.

    &#xA;

    I have a two IP camera which provides a live RTSP video stream.

    &#xA;

    self.input_stream---> rtsp://admin:Admin123@192.168.1.208/user=admin_password=Admin123_channel=0channel_number_stream=0.sdp&#xA;&#xA;self.input_stream---> rtsp://Admin:@192.168.1.209/user=Admin_password=_channel=0channel_number_stream=0.sdp&#xA;

    &#xA;

    Python 3.8.5 (default, Jul 28 2020, 12:59:40)&#xA;[GCC 9.3.0] on linux,

    &#xA;

    Django==3.1.2

    &#xA;

    I am implementing this code in difference Ubuntu PCs

    &#xA;

    Ubuntu = 18.04 and 20.04

    &#xA;

    opencv-contrib-python==4.4.0.46

    &#xA;

    opencv-python==4.4.0.46

    &#xA;

    ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers&#xA;built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)

    &#xA;

    I had tried different fourcc to save .mp4 but below fourcc work perfectly in Ubuntu.

    &#xA;

    fourcc = cv2.VideoWriter_fourcc(*'mp4v')

    &#xA;

    class ffmpegStratStreaming(threading.Thread):&#xA;    def __init__(self, input_stream=None, output_stream=None, camera=None, *args, **kwargs):&#xA;        self.input_stream = input_stream&#xA;        self.output_stream = output_stream&#xA;        self.camera = camera&#xA;        super().__init__(*args, **kwargs)&#xA;&#xA;    def run(self):&#xA;        try:vs = cv2.VideoCapture(self.input_stream)&#xA;            fps_rate = int(vs.get(cv2.CAP_PROP_FPS))&#xA;            ##############################&#xA;            ##############################  &#xA;            # ~ print(&#x27;fps rate-->&#x27;, fps_rate,&#x27;camera id-->&#x27; ,str(self.camera.id))&#xA;            # ~ vs.set(cv2.CAP_PROP_POS_FRAMES,50)  #Set the frame number to be obtained&#xA;            # ~ print(&#x27;fps rate-->&#x27;, fps_rate,&#x27;camera id-->&#x27; ,str(self.camera.id),&#x27; ####### &#x27;)&#xA;            &#xA;            # initialize the video writer (we&#x27;ll instantiate later if need be)&#xA;            writer = None&#xA;&#xA;            # initialize the frame dimensions (we&#x27;ll set them as soon as we read&#xA;            # the first frame from the video)&#xA;            W = None&#xA;            H = None    &#xA;            # start the frames per second throughput estimator&#xA;            fps = FPS().start()&#xA;&#xA;            #  saving frame in avi video format&#xA;            video_file_count = 0&#xA;            start_time = time.time()&#xA;&#xA;            while True:&#xA;                try:&#xA;                    # grab the next frame and handle if we are reading from either&#xA;                    # VideoCapture or VideoStream&#xA;                    &#xA;                    frame_init = vs.read()&#xA;                    frame = frame_init[1] if self.input_stream else frame_init&#xA;                    &#xA;                    # if frame is can&#x27;t read correctly ret is False&#xA;                    while frame_init[0] == False:&#xA;                        print("Can&#x27;t receive frame. Retrying ...")&#xA;                        vs.release()&#xA;                        vs = cv2.VideoCapture(self.input_stream)                                                                              &#xA;                        frame_init = vs.read()&#xA;                        frame = frame_init[1] if self.input_stream else frame_init&#xA;&#xA;                    # if we are viewing a video and we did not grab a frame then we&#xA;                    # have reached the end of the video&#xA;                    if self.input_stream is not None and frame is None:&#xA;                        break&#xA;&#xA;                    # resize the frame to have a maximum width of 500 pixels (the&#xA;                    # less data we have, the faster we can process it), then convert&#xA;                    # the frame from BGR to RGB for dlib&#xA;                    frame = imutils.resize(frame, width=500)        &#xA;                    &#xA;                    &#xA;                    #&lt;---------------------- Start of  writing a video to disk ------------------------->                   &#xA;                    minute = 1&#xA;                    second  = 60&#xA;                    minite_to_save_video = int(minute) * int(second)&#xA;&#xA;                &#xA;                    # if we are supposed to be writing a video to disk, initialize&#xA;                    if time.time() - start_time >= minite_to_save_video or  video_file_count == 0 :&#xA;                        ## where H = heigth, W = width, C = channel &#xA;                        H, W, C = frame.shape&#xA;                        video_file_count &#x2B;= 1&#xA;                        start_time = time.time()&#xA;                        output_save_directory = self.output_stream&#x2B;str(video_file_count)&#x2B;&#x27;.mp4&#x27;&#xA;                        # fourcc = cv2.VideoWriter_fourcc(*"MJPG")&#xA;                        # fourcc = cv2.VideoWriter_fourcc(*&#x27;XVID&#x27;)&#xA;                        # fourcc = cv2.VideoWriter_fourcc(*&#x27;X264&#x27;)&#xA;                        # fourcc = cv2.VideoWriter_fourcc(*&#x27;MP4V&#x27;)&#xA;&#xA;                        &#xA;                        # fourcc = cv2.VideoWriter_fourcc(*&#x27;FMP4&#x27;)&#xA;&#xA;                        # fourcc = cv2.VideoWriter_fourcc(*&#x27;avc1&#x27;)&#xA;&#xA;&#xA;                        # fourcc = cv2.VideoWriter_fourcc(&#x27;M&#x27;,&#x27;J&#x27;,&#x27;P&#x27;,&#x27;G&#x27;)&#xA;&#xA;                        fourcc = cv2.VideoWriter_fourcc(*&#x27;mp4v&#x27;)&#xA;                        # fourcc = cv2.VideoWriter_fourcc(*&#x27;mp3v&#x27;)&#xA;                        # fourcc = 0x00000021&#xA;                        print(fourcc, type(fourcc),&#x27;ffffffff&#x27;)&#xA;                        # a = int(vs.get(cv2.CAP_PROP_FOURCC))&#xA;                        # print(a,type(a),&#x27;  aaaaaaaa&#x27; )&#xA;&#xA;                        # writer = skvideo.io.FFmpegWriter(output_save_directory, outputdict={&#xA;                        #   &#x27;-vcodec&#x27;: &#x27;libx264&#x27;, &#x27;-b&#x27;: &#x27;300000000&#x27;&#xA;                        # })&#xA;                        &#xA;                        # writer = skvideo.io.FFmpegWriter(self.output_stream, outputdict={&#x27;-r&#x27;: &#x27;120&#x27;, &#x27;-c:v&#x27;: &#x27;libx264&#x27;, &#x27;-crf&#x27;: &#x27;0&#x27;, &#x27;-preset&#x27;: &#x27;ultrafast&#x27;, &#x27;-pix_fmt&#x27;: &#x27;yuv444p&#x27;})&#xA;                        &#xA;                        writer = cv2.VideoWriter(output_save_directory, fourcc ,20.0,( int(W), int(H) ), True)&#xA;                        &#xA;                        &#xA;                        # ~ The cv2.VideoWriter requires five parameters:    &#xA;&#xA;                    # check to see if we should write the frame to disk&#xA;                    if writer is not None:                          &#xA;                        try:&#xA;                            writer.write(frame)&#xA;                        except Exception as e:&#xA;                            print(&#x27;Error in writing video output---> &#x27;, e)&#xA;                            &#xA;                    #&lt;---------------------- end of  writing a video to disk ------------------------->&#xA;&#xA;                    # show the output frame&#xA;                    # cv2.imshow("Frame", frame)&#xA;                    # key = cv2.waitKey(1) &amp; 0xFF&#xA;&#xA;                    # if the `q` key was pressed, break from the loop&#xA;                    # if key == ord("q"):&#xA;                    #   break&#xA;&#xA;                    # increment the total number of frames processed thus far and&#xA;                    # then update the FPS counter&#xA;                    totalFrames &#x2B;= 1&#xA;                    fps.update()&#xA;                except Exception as e:&#xA;                    print(&#x27;Error in main while loop--> &#x27;, e)&#xA;&#xA;            # stop the timer and display FPS information&#xA;            fps.stop()&#xA;&#xA;            # check to see if we need to release the video writer pointer&#xA;            # if writer is not None:&#xA;            #   writer.release()&#xA;&#xA;            # if we are not using a video file, stop the camera video stream&#xA;            # if not self.input_stream:&#xA;            #   vs.stop()&#xA;&#xA;            # otherwise, release the video file pointer&#xA;            # else:&#xA;            #   vs.release()&#xA;&#xA;            # close any open windows&#xA;            # cv2.destroyAllWindows()&#xA;        except Exception as e:&#xA;            print(e, &#x27;333333333333333333333333333&#x27;)&#xA;

    &#xA;

    My Django template code

    &#xA;

    {% block main %}&#xA;<div class="row">&#xA;  {% if folders|length == 0 %}&#xA;    <div class="col-md-12 text-center">&#xA;      <h6 class="card-title">There are no files in this directory.</h6>&#xA;    </div>&#xA;  {% else %}&#xA;    {% for folder in folders %}&#xA;      <div class="col-md-3 text-center">&#xA;          <div class="card-block">&#xA;            <video class="video-js vjs-fluid vjs-default-skin" controls="controls" preload="auto" muted="muted" data-setup="&#x27;{" true="true"></video>&#xA;                <source src="{% get_media_prefix %}camera-feed/video-saved/{{pk}}/{{parent}}/{{folder}}" type="video/mp4">&#xA;            &#xA;            <h6 class="card-title">{{folder}}</h6>&#xA;          </source></div>&#xA;      </div>&#xA;    {% endfor %}&#xA;  {% endif %}&#xA;</div>&#xA;{% endblock %}&#xA;

    &#xA;

    Function in view.py to see saved .mp4 video in Django template. Video is saved at local folder.

    &#xA;

    def CameraVideos(request, pk, folder):&#xA;    dirpath = settings.MEDIA_ROOT &#x2B; &#x27;/camera-feed/video-saved/&#x27; &#x2B; str(pk) &#x2B; &#x27;/&#x27; &#x2B; folder&#xA;    folders = sorted(Path(dirpath).iterdir(), key=os.path.getmtime)&#xA;    data = []&#xA;    for file in folders:&#xA;        if not file.name.startswith(&#x27;.&#x27;):&#xA;            data.append(file.name)&#xA;    return render(request, "home/camera_video.html", {&#x27;folders&#x27;: data, &#x27;pk&#x27;: pk, &#x27;parent&#x27;: folder})&#xA;

    &#xA;