Recherche avancée

Médias (1)

Mot : - Tags -/ticket

Autres articles (8)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

Sur d’autres sites (2841)

  • 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.

  • 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.

  • How to stream H.264 bitstream to browser

    21 janvier 2019, par BobtheMagicMoose

    This is a followup to https://raspberrypi.stackexchange.com/questions/93254/stream-usb-webcam-with-audio?noredirect=1#comment150507_93254

    I, like many other brave tinkerers before me, thought it would be a simple task to take an old USB camera (c920) can pair it with a raspberry pi to make a network streaming device (e.g., baby monitor). As those that have gone before me, I have now realized (after two days of tearing my hair out), that this is an extremely complicated task.

    Problem statement : I have a raspberry pi zero and a c920 webcam. I want to use the H.264 bitstream from the webcam and serve it on the pi without transcoding it (the feeble processor would really struggle). I want to combine the video stream with its audio and send it over to a browser (phone, tablet, pc - something HTML5 without NAPI).

    My current strategy is to do the following :

    ffmpeg -re -f s16le -i /dev/zero -f v4l2 -thread_queue_size 512 -codec:v h264 -s 1920x1080 -i /dev/video0 -codec:v copy -acodec aac -ab 128k -g 50 http://localhost:8090/camera.ffm (this is with dummy audio - I figured I would add audio later)

    Followed by sudo ffserver -d -f /etc/ffserver.conf to received the feed and broadcast it as a stream. This is the ffserver.conf file :

    `HTTPPort 8090
    HTTPBindAddress 0.0.0.0
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 100000
    CustomLog -
    <feed>
     File /tmp/streamwebm.ffm
     FileMaxSize 50M
     ACL allow localhost
     ACL allow 128.199.149.46
     #ACL allow 127.0.0.1
     ACL allow 192.168.0.0 192.168.0.255
    </feed>
    <stream stream="stream">
    Format webm

    # Video Settings
    VideoFrameRate 30
    VideoSize 1920x1080

    # Audio settings
    AudioCodec libvorbis
    AudioSampleRate 48000
    AVOptionAudio flags +global_header

    MaxTime 0
    AVOptionVideo me_range 16
    AVOptionVideo qdiff 4
    AVOptionVideo qmin 4
    AVOptionVideo qmax 40
    #AVOptionVideo good
    AVOptionVideo flags +global_header

    # Streaming settings
    PreRoll 10
    StartSendOnKey

    Metadata author "author"
    Metadata copyright "copyright"
    Metadata title "Web app name"
    Metadata comment "comment"
    </stream>

    My basic html is<video>  <source src="http://localhost:8090/stream"> </source></video>

    The stream however, doesn’t work (the browser won’t connect) and I get the following :
    enter image description here

    And the browser on the client says (failed) NET::ERR_CONNECTION_REFUSED

    Thoughts :
    - Begin stream simple mp4 with ffserver explains that ffserver can’t stream .mp4 because of headers or something. This is why I am using webm (which doesn’t support h.264 I believe and is causing the really slow performance converting to vp9). I’m not concerned about CPU usage at the moment, just want to get an image to appear on the browser !

    • I hear one issue deals with ’chunking’ - that the camera h.264 is a bitstream but h.264 streams for html5 should be chunked. Not sure how that would work.

    • I have tried VLC for some things (RTP) but haven’t have success.

    • Most resources (SE and other sites) are from 2010-2015 and it seems as thought v4l2 and other things have developed since then.

    • As my problem is most likely general ignorance of the subject matter, I would appreciate any answers that provide some general understanding as to the theory behind different techniques. I know this makes the question more of a call for opinion and less appropriate for SE, but I’m fixing to throw my computer out the window (you know the feeling).

    Thank you !