Recherche avancée

Médias (0)

Mot : - Tags -/signalement

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

Autres articles (78)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

Sur d’autres sites (4819)

  • JavaFX MediaPlayer unable to play local m3u8 file

    3 mai 2017, par Lennart

    I want to show a live stream of a web cam in my JavaFX application using the MediaPlayer/MediaView. My attempt was to use ffmpeg to record a HLS and to play the resulting m3u8 file, but that throws the following exception (VLC plays the video without problems) :

    MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
       at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)
       at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)
       at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)
       at de.fraunhofer.iosb.ias.flow.assessment.management.monitor.MonitorViewController.testStream(MonitorViewController.java:203)
       ... 58 more
    Caused by: com.sun.media.jfxmedia.MediaException: Could not create player!
       at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:274)
       at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:118)
       at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:467)
       ... 60 more
    </init>

    I debugged the player creation and the error occurs inside the constructor of GSTMediaPlayer when GSTMediaPlayer.gstInitPlayer() is called. This native method returns the error code 257, which javafx maps to MediaError.ERROR_MEDIA_NULL.

    I used the following ffmpeg command to record the video :

    ffmpeg -hide_banner -y -rtbufsize 250MB -f dshow -pixel_format yuv420p -video_size 960x720 -i video="Logitech HD Pro Webcam C920" -c:v libx264 -crf 20 -pix_fmt yuv420p out.m3u8

    I’m pretty sure that the encoding matches the requirements of javafx, because if I change the output container from m3u8 to mp4, the video is played without problems using the exact same ffmpeg command.

    This is the output of ffprobe for the m3u8 file :

    Input #0, hls,applehttp, from 'out.m3u8':
     Duration: 00:00:24.23, start: 1.466667, bitrate: 0 kb/s
     Program 0
       Metadata:
         variant_bitrate : 0
       Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 960x720, 30 fps, 30 tbr, 90k tbn, 60 tbc

    And for the mp4 file :

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.41.100
     Duration: 00:01:04.93, start: 0.000000, bitrate: 1676 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x720, 1673 kb/s, 30 fps, 30 tbr, 10000k tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler

    The resulting m3u8 file looks like this :

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:9
    #EXT-X-MEDIA-SEQUENCE:0
    #EXTINF:8.333322,
    out0.ts
    #EXTINF:8.333333,
    out1.ts
    #EXTINF:7.133322,
    out2.ts
    #EXTINF:0.433333,
    out3.ts
    #EXT-X-ENDLIST

    Update : After I found this reference m3u file, I think that the problem is that the file is stored locally and isn’t delivered via HTTP. The video plays fine with this :

    Media media = new Media("http://download.oracle.com/otndocs/products/javafx/JavaRap/prog_index.m3u8");
    MediaPlayer player = new MediaPlayer(media);
    player.setAutoPlay(true);
    mediaView.setMediaPlayer(player);

    But after I downloaded the reference m3u and all of its segments and tried to open the local file like this, the error occurred again :

    File video = new File("H://Projects//Tools//ref//prog_index.m3u8");
    Media media = new Media(video.toURI().toString());
    MediaPlayer player = new MediaPlayer(media);
    player.setAutoPlay(true);
    mediaView.setMediaPlayer(player);

    I tried to change my m3u file so that the segements are referenced with absolute paths. I tried different notations (H:\f\out0.ts, H:/f/out0.ts, H://f//out0.ts, file:/H:/f/out0.ts, file:///H:/f/out0.ts), but I couldn’t get it to work.

  • JavaFX MediaPlayer unable to play local m3u8 file

    22 février 2020, par Lennart

    I want to show a live stream of a web cam in my JavaFX application using the MediaPlayer/MediaView. My attempt was to use ffmpeg to record a HLS and to play the resulting m3u8 file, but that throws the following exception (VLC plays the video without problems) :

    MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
       at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)
       at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)
       at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)
       at de.fraunhofer.iosb.ias.flow.assessment.management.monitor.MonitorViewController.testStream(MonitorViewController.java:203)
       ... 58 more
    Caused by: com.sun.media.jfxmedia.MediaException: Could not create player!
       at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:274)
       at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:118)
       at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:467)
       ... 60 more
    </init>

    I debugged the player creation and the error occurs inside the constructor of GSTMediaPlayer when GSTMediaPlayer.gstInitPlayer() is called. This native method returns the error code 257, which javafx maps to MediaError.ERROR_MEDIA_NULL.

    I used the following ffmpeg command to record the video :

    ffmpeg -hide_banner -y -rtbufsize 250MB -f dshow -pixel_format yuv420p -video_size 960x720 -i video="Logitech HD Pro Webcam C920" -c:v libx264 -crf 20 -pix_fmt yuv420p out.m3u8

    I’m pretty sure that the encoding matches the requirements of javafx, because if I change the output container from m3u8 to mp4, the video is played without problems using the exact same ffmpeg command.

    This is the output of ffprobe for the m3u8 file :

    Input #0, hls,applehttp, from 'out.m3u8':
     Duration: 00:00:24.23, start: 1.466667, bitrate: 0 kb/s
     Program 0
       Metadata:
         variant_bitrate : 0
       Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 960x720, 30 fps, 30 tbr, 90k tbn, 60 tbc

    And for the mp4 file :

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.41.100
     Duration: 00:01:04.93, start: 0.000000, bitrate: 1676 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x720, 1673 kb/s, 30 fps, 30 tbr, 10000k tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler

    The resulting m3u8 file looks like this :

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:9
    #EXT-X-MEDIA-SEQUENCE:0
    #EXTINF:8.333322,
    out0.ts
    #EXTINF:8.333333,
    out1.ts
    #EXTINF:7.133322,
    out2.ts
    #EXTINF:0.433333,
    out3.ts
    #EXT-X-ENDLIST

    Update : After I found this reference m3u file, I think that the problem is that the file is stored locally and isn’t delivered via HTTP. The video plays fine with this :

    Media media = new Media("http://download.oracle.com/otndocs/products/javafx/JavaRap/prog_index.m3u8");
    MediaPlayer player = new MediaPlayer(media);
    player.setAutoPlay(true);
    mediaView.setMediaPlayer(player);

    But after I downloaded the reference m3u and all of its segments and tried to open the local file like this, the error occurred again :

    File video = new File("H://Projects//Tools//ref//prog_index.m3u8");
    Media media = new Media(video.toURI().toString());
    MediaPlayer player = new MediaPlayer(media);
    player.setAutoPlay(true);
    mediaView.setMediaPlayer(player);

    I tried to change my m3u file so that the segements are referenced with absolute paths. I tried different notations (H:\f\out0.ts, H:/f/out0.ts, H://f//out0.ts, file:/H:/f/out0.ts, file:///H:/f/out0.ts), but I couldn’t get it to work.

  • Why is my .mp4 file created using cv2.VideoWriter not syncing up with the audio when i combine the video and audio using ffmpeg [closed]

    27 décembre 2024, par joeS125

    The aim of the script is to take text from a text file and put it onto a stock video with an ai reading the text. Similar to those reddit stories on social media with parkour minecraft in the background.

    &#xA;

    import cv2&#xA;import time&#xA;from ffpyplayer.player import MediaPlayer&#xA;from Transcription import newTranscribeAudio&#xA;from pydub import AudioSegment&#xA;&#xA;#get a gpt text generation to create a story based on a prompt, for example sci-fi story and spread it over 3-4 parts&#xA;#get stock footage, like minecraft parkour etc&#xA;#write text of script on the footage&#xA;#create video for each part&#xA;#have ai voiceover to read the transcript&#xA;cap = cv2.VideoCapture("Stock_Videos\Minecraft_Parkour.mp4")&#xA;transcription = newTranscribeAudio("final_us.wav")&#xA;player = MediaPlayer("final_us.mp3")&#xA;audio = AudioSegment.from_file("final_us.mp3")&#xA;story = open("Story.txt", "r").read()&#xA;story_split = story.split("||")&#xA;fps = cap.get(cv2.CAP_PROP_FPS)&#xA;frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))&#xA;video_duration = frame_count / fps  # Duration of one loop of the video&#xA;fourcc = cv2.VideoWriter_fourcc(*"mp4v")&#xA;audio_duration = len(audio) / 1000  # Duration in seconds&#xA;video_writer = cv2.VideoWriter(f"CompletedVideo.mp4", fourcc, fps, (1080, 1920))&#xA;&#xA;choice = 0#part of the story choice&#xA;part_split = story_split[choice].split(" ")&#xA;with open("Segment.txt", "w") as file:&#xA;    file.write(story_split[choice])&#xA;start_time = time.time()&#xA;length = len(part_split) - 1&#xA;next_text = []&#xA;for j in range(0, length):&#xA;    temp = part_split[j].replace("\n", "")&#xA;    next_text.append([temp])&#xA;index = 0&#xA;word_index = 0&#xA;frame_size_x = 1080&#xA;frame_size_y = 1920&#xA;audio_duration = len(audio) / 1000  # Duration in seconds&#xA;start_time = time.time()&#xA;wait_time = 1 / fps&#xA;while (time.time() - start_time) &lt; audio_duration:&#xA;    cap.set(cv2.CAP_PROP_POS_FRAMES, 0)  # Restart video&#xA;    elapsed_time = time.time() - start_time&#xA;    print(video_writer)&#xA;    if index >= len(transcription):&#xA;        break&#xA;    while cap.isOpened():&#xA;        # Capture frames in the video &#xA;        ret, frame = cap.read()&#xA;        if not ret:&#xA;            break&#xA;        audio_frame, val = player.get_frame()&#xA;        if val == &#x27;eof&#x27;:  # End of file&#xA;            print("Audio playback finished.")&#xA;            break&#xA;        if index >= len(transcription):&#xA;            break&#xA;        &#xA;        if frame_size_x == -1:&#xA;            frame_size_x = frame.shape[1]&#xA;            frame_size_y = frame.shape[0]&#xA;&#xA;        elapsed_time = time.time() - start_time&#xA;&#xA;        # describe the type of font &#xA;        # to be used. &#xA;        font = cv2.FONT_HERSHEY_SIMPLEX &#xA;        trans = transcription[index]["words"]&#xA;        end_time = trans[word_index]["end"]&#xA;        if trans[word_index]["start"] &lt; elapsed_time &lt; trans[word_index]["end"]:&#xA;            video_text = trans[word_index]["text"]&#xA;        elif elapsed_time >= trans[word_index]["end"]:&#xA;            #index &#x2B;= 1&#xA;            word_index &#x2B;= 1&#xA;        if (word_index >= len(trans)):&#xA;            index &#x2B;= 1&#xA;            word_index = 0&#xA;        # get boundary of this text&#xA;        textsize = cv2.getTextSize(video_text, font, 3, 6)[0]&#xA;        # get coords based on boundary&#xA;        textX = int((frame.shape[1] - textsize[0]) / 2)&#xA;        textY = int((frame.shape[0] &#x2B; textsize[1]) / 2)&#xA;        &#xA;        cv2.putText(frame,  &#xA;                    video_text,  &#xA;                    (textX, textY),  &#xA;                    font, 3,  &#xA;                    (0, 255, 255),  &#xA;                    6,  &#xA;                    cv2.LINE_4)&#xA;        &#xA;        # Define the resize scale&#xA;        scale_percent = 50  # Resize to 50% of the original size&#xA;        # Get new dimensions&#xA;        width = 1080&#xA;        height = 1920&#xA;        new_size = (width, height)&#xA;&#xA;        # Resize the frame&#xA;        resized_frame = cv2.resize(frame, new_size)&#xA;        video_writer.write(resized_frame)&#xA;        cv2.imshow(&#x27;video&#x27;, resized_frame)&#xA;        cv2.waitKey(wait_time)&#xA;        if cv2.waitKey(1) &amp; 0xFF == ord(&#x27;q&#x27;): &#xA;            break&#xA;cv2.destroyAllWindows()&#xA;video_writer.release()&#xA;cap.release()&#xA;&#xA;

    &#xA;

    When I run this script the audio matches the text in the video perfectly and it runs for the correct amount of time to match with the audio (2 min 44 sec). However, the saved video CompletedVideo.mp4 only lasts for 1 min 10 sec. I am unsure why the video has sped up. The fps is 60 fps. If you require any more information please let me know and thanks in advance.

    &#xA;

    I have tried changing the fps, changing the wait_time after writing each frame. I am expecting the CompletedVideo.mp4 to be 2 min 44 sec long not 1 min 10 sec long.

    &#xA;