Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (53)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • 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

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (8768)

  • Stream h264 to javafx possibly using javacv/ffmpeg

    4 octobre 2018, par cagney

    I’m really stuck on getting a video stream to play on a java fx project.

    — Short version :

    I’m streaming h264/avcc flavor video from an android phone to a desktop computer. However javafx doesn’t have an easy solution for displaying stream. I’m attempting to use javacv / ffmpeg in an attempt to make this work. However I am getting errors from ffmpeg.

    1) Is there a better way to display streaming video on javafx ?

    2) Do you have a sample project or good tutorial for javacv ffmpegframegrabber ?

    3) I think I may be missing some small detail in mycode but Im not sure what i would be.

    — Longer Version :

    1) On the android end Im getting video using mediarecorder. In order to get the sps/pps info I record and save a small movie to the device and then parse the sps and pps data.

    2) Next, on the android, I split up the nalus to meet MTU req and send them over a udp connection to my desktop

    3)On my desktop I reassmble the nalus( or trash them if they loose data) and feed those to an input stream that I gave to the framegreabber constructor.

    — The Code and Logs :

    The errors are long and numerous depending on the flavor I feed it. Here are two separate examples which are usually repeated at great length

    [h264 @ 0000020225907a40] non-existing PPS 0 referenced
    [h264 @ 0000020225907a40] decode_slice_header error
    [h264 @ 0000020225907a40] no frame!

    [h264 @ 00000163d8637a40] illegal aspect ratio
    [h264 @ 00000163d8637a40] pps_id 3412 out of range
    [AVBSFContext @ 00000163e28a0e00] Invalid NAL unit 0, skipping.

     !! One big caveat that I am aware off is that I have not implemented timestamps
    which I created on the android device when feeding ffmpeg. I think it should still show distorted images without this though

    Because I have spent all day guessing and trying I have several "flavors" of data I have shoved through. I am only showing the first section of each nal which I believe if correct would at least show a garbage image as long as my sps and pps are right

    sps: 67 80 80 1E E9 01 68 22 FD C0 36 85 09 A8
    pps: 68 06 06 E2

    Below is annex B style.
    These were each prefixed with either 00 00 01 and 00 00 00 01

    Debug transfer 65 B8 40 0B E5 B8 7B 80 5B 85
    Debug transfer 41 E2 20 7A 74 34 3B D6 BE FA
    Debug transfer 41 E4 40 2F 01 E0 0C 06 EE 91
    Debug transfer 41 E6 60 3E A1 20 5A 02 3C 6D
    Debug transfer 41 E8 80 13 B0 B9 82 C3 03 F4
    Debug transfer 41 EC C0 1B A3 0C 28 F1 B0 C8
    Debug transfer 41 EE E0 1F CE 07 30 EE 05 06
    Debug transfer 41 F1 00 08 ED 80 9C 20 09 73
    Debug transfer 41 F3 20 09 E9 00 86 60 21 C3
    VideoDecoderaddPacket type: 24
    Debug transfer 67 80 80 1E E9 01 68 22 FD C0
    Debug transfer 68 06 06 E2
    Debug transfer 65 B8 20 00 9F 80 78 00 12 8A
    Debug transfer 41 E2 20 09 F0 1E 40 7B 0C E0
    Debug transfer 41 E4 40 09 F0 29 30 D6 00 AE
    Debug transfer 41 E6 60 09 F1 48 31 80 99 40
    [h264 @ 000001c771617a40] non-existing PPS 0 referenced

    Here I tried Avcc style. You can see the first line is the combination of the sps pps followed by idr and then repeated non idr

    Debug transfer 18 00 0E 67 80 80 1E E9 01 68
    Debug transfer 00 02 4A 8F 65 B8 20 00 9F C5
    Debug transfer 00 02 2F DA 41 E2 20 09 E8 0F
    Debug transfer 00 02 2C 34 41 E4 40 09 F4 20
    Debug transfer 00 02 4D 92 41 E6 60 09 FC 2B
    Debug transfer 00 02 47 02 41 E8 80 09 F0 72
    Debug transfer 00 02 52 50 41 EA A0 09 EC 0F
    Debug transfer 00 02 58 8A 41 EC C0 09 FC 6F
    Debug transfer 00 02 55 F9 41 EE E0 09 FC 6E
    Debug transfer 00 02 4D 79 41 F1 00 09 F0 3E
    Debug transfer 00 02 4D B6 41 F3 20 09 E8 64

    The following class is where I try to get javacv/ffmpeg to show the video. I dont think its an ideal solution and am researching canvasfram as a replacement to the image view.

       public class ImageDecoder {

       private final static String TAG = "ImageDecoder ";

       private ImageDecoder(){

       }


       public static void streamImageToImageView(
               final ImageView view,
               final InputStream inputStream,
               final String format,
               final int frameRate,
               final int bitrate,
               final String preset,
               final int numBuffers
       )
       {
           System.out.println("Image Decoder Starting...");


           try(    final FrameGrabber grabber = new
       FFmpegFrameGrabber(inputStream))
           {

               final Java2DFrameConverter converter = new Java2DFrameConverter();

               grabber.setFrameNumber(frameRate);
               grabber.setFormat(format);
               grabber.setVideoBitrate(bitrate);
               grabber.setVideoOption("preset", preset);
               grabber.setNumBuffers(numBuffers);

               System.out.println("Image Decoder waiting on grabber.start...");
               grabber.start();   //---- this call is blocking the loop

               System.out.println("Image Decoder Looping---------------------------
      -------- hit stop");
               while(!Thread.interrupted()){
                   //System.out.println("Image Decoder Looping");
                   final Frame frame = grabber.grab();
                   if (frame != null){
                       final BufferedImage bufferedImage =
       converter.convert(frame);
                       if (bufferedImage != null){

                           Platform.runLater(() ->
       view.setImage(SwingFXUtils.toFXImage(bufferedImage, null)));
                       }else{
                           System.out.println("no buf im");
                       }
                   }else{
                       System.out.println("no fr");
                       Thread.currentThread().interrupt();
                   }

               }



           }catch (Exception e){
               System.out.print(TAG + e);
           }


       }






       }

    Any help is greatly appreciated.

  • How to resize an mp4 video and reduce frame rate while keeping quality ?

    1er décembre 2019, par Jules

    I’m trying to resize (keeping quality) and reduce frame rate to 30, I’ve seen various command but I’m having difficulty.

    This seems to resize nicely

    ffmpeg -i final-video.mp4 -aspect 886:1920 -c copy final-resized.mp4

    I’ve also see -r 30 and -filter:v fps=fps=30

    But neither seem to work in-conjunction with the resize command.

    I’ve seen posts like this
    Re-sampling H264 video to reduce frame rate while maintaining high image quality
    But this takes a long time.

  • How to apply 'simple 'opacity to combined(layered) mp4s in FFMPEG

    27 mai 2021, par Cam

    I am not getting the final image results I need when layering together multiple mp4s of the same length and format into a single output MP4. I am using ffmpeg to create a pseudo 'motion blur' effect on animation, and need to layer mp4s together with identical opacities to produce the final video.

    


    I am using a base 'black' MP4 as the first layer for a background, and then adding a series of source mp4s with equal opacity over the top in each pass. Here I am showing a photoshop mockup using their 'normal' blending mode which is exactly the blending effect I am trying to replicate with ffmpeg. I understand that the final composite is less "bright" but that's fine (unless you have any ideas).
photoshop mockup

    


    Instead of looking like the result above, I am getting output where the colors are either all pink, garbled, super dark or generally hugely overbright etc based on trying different blend modes.

    


    Here are the commands I am using :

    


    To create the original (uncompressed ?) 'black' MP4 from a sequence of black pngs :

    


    ffmpeg -start_number 0 -r 24 -f image2 -s 1920x1080 -i black_seq.%04d.png -vcodec libx264 -crf 0 -pix_fmt yuv420p   black_seq.mp4 -y


    


    I then take that "black_seq.mp4" and blend a set of n number of source mp4s over the top with an opacity value. This runs in a loop and the output.mp4 of each pass becomes the input.mp4 of the next pass until it completes. In this example a total of 10 source mp4s assigns their opacity to 0.1 for each pass, and this is a single pass (below). The source mp4s are all very similar in their appearance and color, essentially just the same sequence of animation but offset in time by fractions of a single frame and have been generated from color pngs, using the same code that produced the first black layer (above).

    


    ffmpeg i input.mp4 -i n_layer.mp4 -vcodec libx264 -crf 0 -pix_fmt yuv420p   -filter_complex "blend=all_mode='overlay':all_opacity=0.1" output.mp4 -y


    


    Then finally add some compression to the result as the final "blur.mp4"

    


    ffmpeg -i "output.mp4" -vcodec libx264 -crf 25 -pix_fmt yuv420p "blur.mp4" -y


    


    And yes, this is certainly highly inefficient as an approach, but I am learning. The main issue I am trying to solve is, despite the final blur.mp4 being less "bright", it has colors that are not matching the original animation and instead looks like the animation has been hue shifted somehow.

    


    This image shows a cropped output for comparison (the processed blur is set to zero for clarity)
input and output example pic

    


    I would love some insight.