Recherche avancée

Médias (91)

Autres articles (72)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (14600)

  • ffmpeg : crop video into two grayscale sub-videos ; guarantee monotonical frames ; and get timestamps

    13 mars 2021, par lurix66

    The need

    


    Hello, I need to extract two regions of a .h264 video file via the crop filter into two files. The output videos need to be monochrome and extension .mp4. The encoding (or format ?) should guarantee that video frames are organized monotonically. Finally, I need to get the timestamps for both files (which I'd bet are the same timestamps that I would get from the input file, see below).

    


    In the end I will be happy to do everything in one command via an elegant one liner (via a complex filter I guess), but I start doing it in multiple steps to break it down in simpler problems.

    


    In this path I get into many difficulties and despite having searched in many places I don't seem to find solutions that work. Unfortunately I'm no expert of ffmpeg or video conversion, so the more I search, the more details I discover, the less I solve problems.

    


    Below you find some of my attempts to work with the following options :

    


      

    • -filter:v "crop=400:ih:260:0,format=gray" to do the crop and the monochrome conversion
    • 


    • -vf showinfo possibly combined with -vsync 0 or -copyts to get the timestamps via stderr redirection &> filename
    • 


    • -c:v mjpeg to force monotony of frames (are there other ways ?)
    • 


    


    1. cropping each region and obtaining monochrome videos

    


    $ ffmpeg -y -hide_banner -i inVideo.h264 -filter:v "crop=400:ih:260:0,format=gray" outL.mp4
$ ffmpeg -y -hide_banner -i inVideo.h264 -filter:v "crop=400:ih:1280:0,format=gray" outR.mp4


    


    The issue here is that in the output files the frames are not organized monotonically (I don't understand why ; how come would that make sense in any video format ? I can't say if that comes from the input file).

    


    EDIT. Maybe it is not frames, but packets, as returned by av .demux() method that are not monotonic (see below "instructions to reproduce...")

    


    I have got the advice to do a ffmpeg -i outL.mp4 outL.mjpeg after, but this produces two videos that look very pixellated (at least playing them with ffplay) despite being surprisingly 4x bigger than the input. Needless to say, I need both monotonic frames and lossless conversion.

    


    EDIT. I acknowledge the advice to specify -q:v 1 ; this fixes the pixellation effect but produces a file even bigger, 12x in size. Is it necessary ? (see below "instructions to reproduce...")

    


    2. getting the timestamps

    


    I found this piece of advice, but I don't want to generate hundreds of image files, so I tried the following :

    


    $ ffmpeg -y -hide_banner -i outL.mp4 -vf showinfo -vsync 0 &>tsL.txt
$ ffmpeg -y -hide_banner -i outR.mp4 -vf showinfo -vsync 0 &>tsR.txt


    


    The issue here is that I don't get any output because ffmpeg claims it needs an output file.

    


    The need to produce an output file, and the doubt that the timestamps could be lost in the previous conversions, leads me back to making a first attempt of a one liner, where I am testing also the -copyts option, and the forcing the encoding with -c:v mjpeg option as per the advice mentioned above (don't know if in the right position though)

    


    ffmpeg -y -hide_banner -i testTex2.h264 -copyts -filter:v "crop=400:ih:1280:0,format=gray" -vf showinfo -c:v mjpeg eyeL.mp4 &>tsL.txt


    


    This does not work because surprisingly the output .mp4 I get is the same as the input. If instead I put the -vf showinfo option just before the stderr redirection, I get no redirected output

    


    ffmpeg -y -hide_banner -i testTex2.h264 -copyts -filter:v "crop=400:ih:260:0,format=gray" -c:v mjpeg outR.mp4 -vf showinfo dummy.mp4 &>tsR.txt


    


    In this case I get the desired timestamps output (too much : I will need some solution to grab only the pts and pts_time data out of it) but I have to produce a big dummy file. The worst thing is anyway, that the mjpeg encoding produces a low resolution very pixellated video again

    


    I admit that the logic how to place the options and the output files on the command line is obscure to me. Possible combinations are many, and the more options I try the more complicated it gets, and I am not getting much closer to the solution.

    


    3. [EDIT] instructions how to reproduce this

    


      

    • get a .h264 video
    • 


    • turn it into .mp by ffmpeg command $ ffmpeg -i inVideo.h264 out.mp4
    • 


    • run the following python cell in a jupyter-notebook
    • 


    • see that the packets timestamps have diffs greater and less than zero
    • 


    


    %matplotlib inline
import av
import numpy as np
import matplotlib.pyplot as mpl

fname, ext="outL.direct", "mp4"

cont=av.open(f"{fname}.{ext}")
pk_pts=np.array([p.pts for p in cont.demux(video=0) if p.pts is not None])

cont=av.open(f"{fname}.{ext}")
fm_pts=np.array([f.pts for f in cont.decode(video=0) if f.pts is not None])

print(pk_pts.shape,fm_pts.shape)

mpl.subplot(211)
mpl.plot(np.diff(pk_pts))

mpl.subplot(212)
mpl.plot(np.diff(fm_pts))


    


      

    • finally create also the mjpeg encoded files in various ways, and check packets monotony with the same script (see also file size)
    • 


    


    $ ffmpeg -i inVideo.h264 out.mjpeg
$ ffmpeg -i inVideo.h264 -c:v mjpeg out.c_mjpeg.mp4
$ ffmpeg -i inVideo.h264 -c:v mjpeg -q:v 1 out.c_mjpeg_q1.mp4


    


    Finally, the question

    


    What is a working way / the right way to do it ?

    


    Any hints, even about single steps and how to rightly combine them will be appreciated. Also, I am not limited tio the command line, and I would be able to try some more programmatic solution in python (jupyter notebook) instead of the command line if someone points me in that direction.

    


  • Merge commit ’e64f0bf2d2b1347ec9461f0e82852a62e8c6ffbe’

    4 août 2014, par Michael Niedermayer
    Merge commit ’e64f0bf2d2b1347ec9461f0e82852a62e8c6ffbe’
    

    * commit ’e64f0bf2d2b1347ec9461f0e82852a62e8c6ffbe’ :
    png : support reading gray+alpha at 16 bits

    Merged-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavcodec/pngdec.c
  • How to debayer bmp image with FFMpeg ? (.exe file)

    19 mai 2021, par Aleksey Timoshchenko

    I have an bayer image .bmp I would like to debayer with FFMpeg, I thought that possibly FFMpeg knows to debayer it by default so I tried to use such a very simple query

    &#xA;

    ffmpeg -i input.bmp output.png&#xA;

    &#xA;

    but output.png looks gray, so ffmpeg doesn't apply debayer automatically. I tried to figure out if is it possible with ffmpeg, but there is almost nothing about it on google.

    &#xA;

    Image example (it is too large to upload it here) : https://drive.google.com/file/d/1V8HwOuIo9PBX3ix0eKFQFGimskU_H0mN/view?usp=sharing

    &#xA;

    How to do it ?

    &#xA;

    UPD

    &#xA;

    this is what I tried to do

    &#xA;

    ffmpeg -y -i D:\Buffer\Bayer\Time0000000_img.bmp -pix_fmt gray D:\Buffer\Bayer\bmp\test11.y -hide_banner&#xA;ffmpeg -y -pixel_format bayer_rggb8 -video_size 4104x3006 -i D:\Buffer\Bayer\bmp\test11.y D:\Buffer\Bayer\bmp\result1.png -hide_banner&#xA;

    &#xA;

    and there is an error I get

    &#xA;

    Input #0, image2, from &#x27;D:\Buffer\Bayer\bmp\test11.y&#x27;:&#xA;  Duration: 00:00:00.04, start: 0.000000, bitrate: 1013196 kb/s&#xA;    Stream #0:0: Video: rawvideo ([186]RG[8] / 0x84752BA), bayer_rggb8, 4104x3006, 25 tbr, 25 tbn, 25 tbc&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (rawvideo (native) -> png (native))&#xA;Press [q] to stop, [?] for help&#xA;[rawvideo @ 0000027da39d3f80] Invalid buffer size, packet size 5065984 &lt; expected frame_size 12336624&#xA;Error while decoding stream #0:0: Invalid argument&#xA;Output #0, image2, to &#x27;D:\Buffer\Bayer\bmp\result1.png&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.29.100&#xA;    Stream #0:0: Video: png, rgb24, 4104x3006, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc&#xA;    Metadata:&#xA;      encoder         : Lavc58.54.100 png&#xA;frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x&#xA;video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)&#xA;Conversion failed!&#xA;

    &#xA;

    if I change the resolution to 1920x1080 like this

    &#xA;

    ffmpeg -y -pixel_format bayer_rggb8 -video_size 1920x1080 -i D:\Buffer\Bayer\bmp\test11.y D:\Buffer\Bayer\bmp\result1.png -hide_banner&#xA;

    &#xA;

    I don't get an error, but the output is wrong

    &#xA;

    enter image description here

    &#xA;