Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (57)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • 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

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

Sur d’autres sites (7054)

  • Writing frames from camera using skvideo.io.FFmpegWriter

    28 juin 2018, par Liam Deacon

    I’m trying to finely control the video encoding of camera image frames captured on the fly using skvideo.io.FFmpegWriter and cv2.VideoCapture, e.g.

    from skvideo import io
    import cv2

    fps = 60
    stream = cv2.VideoCapture(0)                    # 0 is for /dev/video0
    print("fps: {}".format(stream.set(cv2.CAP_PROP_FPS, fps)))

    stream.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
    stream.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
    print("bit_depth: {}".format(stream.set(cv2.CAP_PROP_FORMAT, cv2.CV_8U)))

    video = io.FFmpegWriter('/tmp/test_ffmpeg.avi',
               inputdict={'-r': fps, '-width': 1920, '-height': 1080},
               outputdict={'-r': fps, '-vcodec': 'libx264', '-pix_fmt': 'h264'}
    )

    try:
       for i in range(fps*10):  # 10s of video
           ret, frame = stream.read()
           video.writeFrame(frame)
    finally:
       stream.release()

    try:
       video.close()
    except:
       pass

    However, I get the following exception (in Jupyter notebook) :

    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)

    in <module>()
        18     while range(fps*10):
        19         ret, frame = stream.read()
    ---> 20         video.writeFrame(frame)
        21 except BaseException as err:
        22     raise err

    /usr/local/lib/python3.6/site-packages/skvideo/io/ffmpeg.py in writeFrame(self, im)
       446         T, M, N, C = vid.shape
       447         if not self.warmStarted:
    --> 448             self._warmStart(M, N, C)
       449
       450         # Ensure that ndarray image is in uint8

    /usr/local/lib/python3.6/site-packages/skvideo/io/ffmpeg.py in _warmStart(self, M, N, C)
       412         cmd = [_FFMPEG_PATH + "/" + _FFMPEG_APPLICATION, "-y"] + iargs + ["-i", "-"] + oargs + [self._filename]
       413
    --> 414         self._cmd = " ".join(cmd)
       415
       416         # Launch process

    TypeError: sequence item 3: expected str instance, int found
    </module>

    Changing this to video.writeFrame(frame.tostring()) results in ValueError: Improper data input, leaving me stumped.

    How should I go about writing each frame (as returned by OpenCV) to my FFmpegWriter instance ?

    EDIT

    The code works fine if I remove inputdict and outputdict from the io.FFmpegWriter call, however this defeats the purpose for me as I need fine control over the video encoding (I am experimenting with lossless/near-lossless compression of the raw video captured from the camera and trying to establish the best compromise in terms of compression vs fidelity for my needs).

  • Slow audio-video sync drift when merging wav and mp4 with ffmpeg

    27 juin 2018, par charlie80

    I have an mp4 file with only a single video stream (no audio) and a wav audio file that I would like to add to the video using ffmpeg. The audio and the video have been recorded simultaneously during a conference, the former from a mixer output on a PC and the latter from a digital videocamera.

    I am using this ffmpeg command :

    ffmpeg -i incontro3.mp4 -itsoffset 18.39 -i audio_mix.wav -c:v copy -c:a aac final-video.mp4

    where I’m using the -itsoffset 18.39 option since I know that 18.39s is the video-audio delay.

    The problem I’m experiencing is that in the output file, while the audio is perfectly in sync with the video at the beginning, it slowly drifts out of sync during the movie.

    The output if ffprobe on the video file is :

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'incontro3.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.25.100
     Duration: 00:47:22.56, start: 0.000000, bitrate: 888 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 886 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
       Metadata:
         handler_name    : VideoHandler

    and the ffprobe output for the audio file is :

    Input #0, wav, from 'audio_mix.wav':
     Metadata:
       track           : 5
       encoder         : Lavf57.25.100
     Duration: 00:46:32.20, bitrate: 1411 kb/s
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s

    I’m using the latest ffmpeg Zeranoe windows build git-9591ca7 (2016-05-25).

    Thanks in anticipation for any help/ideas !


    UPDATE 1 : It looks like the problem is upstream the video-audio merging, and could be in the concatenation and conversion of the MTS files generated by the video camera into the mp4 video. I will follow up as I make any progress in understanding...


    UPDATE 2 : The problem is not in the initial merging of the MTS files generated by the camera. Or, at least, it occurs identically if I merge them with cat or with ffmpeg -f concat


    UPDATE 3 : Following @Mulvya’s suggestion, I observed that the drift rate is constant (at least as far as I can tell judging by eye). I also tried to superimpose the A/V tracks with another software, and the drift is exactly the same, thereby ruling out ffmpeg as culprit. My (bad) feeling is that the issue could be related to the internal clocks of the digital video camera and the laptop used for audio recording running at slightly different rates (see here the report of an identical issue I just found).

  • Error while installing ffmpeg on standalone computer

    10 juillet 2018, par newuser

    I am trying to install libx264 and ffmpeg on a computer without internet access
    My plan is to first download all required packages and dependencies on a laptop with internet and then copy them over
    To download the packages I used :

    apt-get download $(apt-rdepends <package>|grep -v "^ ")
    </package>

    I was able to install yasm, libvpx and libx264 without issues this way.
    When I try to install ffmpeg, I get this error.

    The following packages have unmet dependencies:
    chromium-codecs-ffmpeg-extra-dbg : Depends: chromium-codecs-ffmpeg-extra (= 51.0.2704.79-0ubuntu0.16.04.1.1242) but 66.0.3359.181-0ubuntu0.16.04.1 is installed
    ffmpeg-dbg : Depends: ffmpeg (= 7:2.8.14-0ubuntu0.16.04.1)
    ffmpeg-doc : Depends: libjs-bootstrap but it is not installed
    ffmpeg2theora : Depends: liboggkate1 (>= 0.3.0) but it is not installed
    ffmpegthumbs : Depends: libkf5kiowidgets5 (>= 4.99.0) but it is not installed
    kffmpegthumbnailer : Depends: libkio5 (>= 4:4.3.4) but it is not installed
    moc-ffmpeg-plugin : Depends: moc (= 1:2.6.0~svn-r2788-1) but it is not installed

    where do I get these packages from ? I dont want apt-get to download them for me as I want to be able to get the package files.