Recherche avancée

Médias (91)

Autres articles (105)

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

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

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

Sur d’autres sites (8944)

  • Cannot get mp4 video to play in JavaFX app

    23 juin 2016, par CelestialCoyote

    I am trying to use the media player in Java FX to play an mp4 video. I am using the example code from the Oracle. Here is the link.

    http://docs.oracle.com/javafx/2/media/simpleplayer.htm

    I am using the same code with the exception that I want to play the video from my computer rather than going to the internet to get it. I also changed the size of the window to match the size of my video. The video was rendered using FFMPEG with the following parameters.

    ffmpeg -y -r 30 -i ’CellCellCell_Trailer_%05d.jpg’ -r 30 -pix_fmt yuv420p -s 512x512 -vcodec libx264 ’CellCellCell.mp4’

    Could not attach the video to post.

    The video plays in Quicktime and VLC without problems. In the Java App it appears to load, but does not start playing. If I move the time slider, it throws an error, otherwise it just sits there and nothing happens. The file is in a folder called ’media’.

    I have tried several mp4 videos, all with the same results. The player opens, but then does nothing. Any help would be appreciated.

    Here is the code for MediaControl.java file. It is unmodified from the Oracle example.

    package embeddedmediaplayer;

    import javafx.application.Platform;
    import javafx.beans.InvalidationListener;
    import javafx.beans.Observable;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.layout.Priority;
    import javafx.scene.layout.Region;
    import javafx.geometry.Insets;
    import javafx.geometry.Pos;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.control.Slider;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.HBox;
    import javafx.scene.layout.Pane;
    import javafx.scene.media.MediaPlayer;
    import javafx.scene.media.MediaPlayer.Status;
    import javafx.scene.media.MediaView;
    import javafx.util.Duration;

    public class MediaControl extends BorderPane {

    private MediaPlayer mp;
    private MediaView mediaView;
    private final boolean repeat = false;
    private boolean stopRequested = false;
    private boolean atEndOfMedia = false;
    private Duration duration;
    private Slider timeSlider;
    private Label playTime;
    private Slider volumeSlider;
    private HBox mediaBar;

    public MediaControl(final MediaPlayer mp) {
       this.mp = mp;
       setStyle("-fx-background-color: #bfc2c7;");
       mediaView = new MediaView(mp);
       Pane mvPane = new Pane() {
       };
       mvPane.getChildren().add(mediaView);
       mvPane.setStyle("-fx-background-color: black;");
       setCenter(mvPane);

       mediaBar = new HBox();
       mediaBar.setAlignment(Pos.CENTER);
       mediaBar.setPadding(new Insets(5, 10, 5, 10));
       BorderPane.setAlignment(mediaBar, Pos.CENTER);

       final Button playButton = new Button(">");

       playButton.setOnAction(new EventHandler<actionevent>() {
           public void handle(ActionEvent e) {
               Status status = mp.getStatus();

               if (status == Status.UNKNOWN || status == Status.HALTED) {
                   // don't do anything in these states
                   return;
               }

               if (status == Status.PAUSED
                       || status == Status.READY
                       || status == Status.STOPPED) {
                   // rewind the movie if we're sitting at the end
                   if (atEndOfMedia) {
                       mp.seek(mp.getStartTime());
                       atEndOfMedia = false;
                   }
                   mp.play();
               } else {
                   mp.pause();
               }
           }
       });
       mp.currentTimeProperty().addListener(new InvalidationListener() {
           public void invalidated(Observable ov) {
               updateValues();
           }
       });

       mp.setOnPlaying(new Runnable() {
           public void run() {
               if (stopRequested) {
                   mp.pause();
                   stopRequested = false;
               } else {
                   playButton.setText("||");
               }
           }
       });

       mp.setOnPaused(new Runnable() {
           public void run() {
               System.out.println("onPaused");
               playButton.setText(">");
           }
       });

       mp.setOnReady(new Runnable() {
           public void run() {
               duration = mp.getMedia().getDuration();
               updateValues();
           }
       });

       mp.setCycleCount(repeat ? MediaPlayer.INDEFINITE : 1);
       mp.setOnEndOfMedia(new Runnable() {
           public void run() {
               if (!repeat) {
                   playButton.setText(">");
                   stopRequested = true;
                   atEndOfMedia = true;
               }
           }
       });

       mediaBar.getChildren().add(playButton);
       // Add spacer
       Label spacer = new Label("   ");
       mediaBar.getChildren().add(spacer);

       // Add Time label
       Label timeLabel = new Label("Time: ");
       mediaBar.getChildren().add(timeLabel);

       // Add time slider
       timeSlider = new Slider();
       HBox.setHgrow(timeSlider, Priority.ALWAYS);
       timeSlider.setMinWidth(50);
       timeSlider.setMaxWidth(Double.MAX_VALUE);
       timeSlider.valueProperty().addListener(new InvalidationListener() {
           public void invalidated(Observable ov) {
               if (timeSlider.isValueChanging()) {
                   // multiply duration by percentage calculated by slider position
                   mp.seek(duration.multiply(timeSlider.getValue() / 100.0));
               }
           }
       });
       mediaBar.getChildren().add(timeSlider);

       // Add Play label
       playTime = new Label();
       playTime.setPrefWidth(130);
       playTime.setMinWidth(50);
       mediaBar.getChildren().add(playTime);

       // Add the volume label
       Label volumeLabel = new Label("Vol: ");
       mediaBar.getChildren().add(volumeLabel);

       // Add Volume slider
       volumeSlider = new Slider();
       volumeSlider.setPrefWidth(70);
       volumeSlider.setMaxWidth(Region.USE_PREF_SIZE);
       volumeSlider.setMinWidth(30);
       volumeSlider.valueProperty().addListener(new InvalidationListener() {
           public void invalidated(Observable ov) {
               if (volumeSlider.isValueChanging()) {
                   mp.setVolume(volumeSlider.getValue() / 100.0);
               }
           }
       });
       mediaBar.getChildren().add(volumeSlider);

       setBottom(mediaBar);
    }

    protected void updateValues() {
       if (playTime != null &amp;&amp; timeSlider != null &amp;&amp; volumeSlider != null) {
           Platform.runLater(new Runnable() {
               public void run() {
                   Duration currentTime = mp.getCurrentTime();
                   playTime.setText(formatTime(currentTime, duration));
                   timeSlider.setDisable(duration.isUnknown());
                   if (!timeSlider.isDisabled()
                           &amp;&amp; duration.greaterThan(Duration.ZERO)
                           &amp;&amp; !timeSlider.isValueChanging()) {
                       timeSlider.setValue(currentTime.divide(duration).toMillis()
                               * 100.0);
                   }
                   if (!volumeSlider.isValueChanging()) {
                       volumeSlider.setValue((int) Math.round(mp.getVolume()
                               * 100));
                   }
               }
           });
       }
    }

    private static String formatTime(Duration elapsed, Duration duration) {
       int intElapsed = (int) Math.floor(elapsed.toSeconds());
       int elapsedHours = intElapsed / (60 * 60);
       if (elapsedHours > 0) {
           intElapsed -= elapsedHours * 60 * 60;
       }
       int elapsedMinutes = intElapsed / 60;
       int elapsedSeconds = intElapsed - elapsedHours * 60 * 60
               - elapsedMinutes * 60;

       if (duration.greaterThan(Duration.ZERO)) {
           int intDuration = (int) Math.floor(duration.toSeconds());
           int durationHours = intDuration / (60 * 60);
           if (durationHours > 0) {
               intDuration -= durationHours * 60 * 60;
           }
           int durationMinutes = intDuration / 60;
           int durationSeconds = intDuration - durationHours * 60 * 60
                   - durationMinutes * 60;
           if (durationHours > 0) {
               return String.format("%d:%02d:%02d/%d:%02d:%02d",
                       elapsedHours, elapsedMinutes, elapsedSeconds,
                       durationHours, durationMinutes, durationSeconds);
           } else {
               return String.format("%02d:%02d/%02d:%02d",
                       elapsedMinutes, elapsedSeconds, durationMinutes,
                       durationSeconds);
           }
       } else {
           if (elapsedHours > 0) {
               return String.format("%d:%02d:%02d", elapsedHours,
                       elapsedMinutes, elapsedSeconds);
           } else {
               return String.format("%02d:%02d", elapsedMinutes,
                       elapsedSeconds);
           }
       }
    }
    }
    </actionevent>

    Here is the code for the EmbeddedMediaPlayer.java file. Only modifications are the file to be played and the size of the window.

    package embeddedmediaplayer;

    import javafx.application.Application;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.media.Media;
    import javafx.scene.media.MediaPlayer;
    import javafx.scene.media.MediaView;
    import javafx.scene.Scene;
    import javafx.stage.Stage;

    public class EmbeddedMediaPlayer extends Application {

    //    private static final String MEDIA_URL =
    //            "http://download.oracle.com/otndocs/products/javafx/oow2010-  2.flv";

    private static final String MEDIA_URL =
           "file:./media/CellCellCell.mp4";

    @Override
    public void start(Stage primaryStage) {
       primaryStage.setTitle("Embedded Media Player");
       Group root = new Group();
       Scene scene = new Scene(root, 512, 512);

       // create media player
       Media media = new Media (MEDIA_URL);
       MediaPlayer mediaPlayer = new MediaPlayer(media);
       mediaPlayer.setAutoPlay(true);
       MediaControl mediaControl = new MediaControl(mediaPlayer);
       scene.setRoot(mediaControl);

       primaryStage.setScene(scene);
       primaryStage.show();
    }


    public static void main(String[] args) {
       launch(args);
    }
    }
  • ffmpeg command to combine audio and images

    4 février 2013, par jeet

    I'm trying to achieve something which I earlier thought should be a simple task.
    Is there a ffmpeg command that can do the following :

    convert an audio.wav file to a video,
    Add some 100 pics (img%d.png) to the video so they "automatically" stretch to fill the entire length of the video.

    I don't want to set the frame rate manually because it's either making the audio go ahead or lack behind.

    I also don't want the following to happen, which happenned when I used "loop_input" :

    A short video of images got created, which played fast and then repeated itself for the entire duration of the audio.

    Please let me know the command.

    I've currently tried the following, but these are not giving me the desired results :

    This one makes, but video goes fast and audio is not full :

    ffmpeg -i img%d.png -i audio.wav -acodec copy output.mpg

    This one makes short video which repeats for full audio duration :

    ffmpeg -loop_input -shortest -i img%d.png -i audio.wav -acodec copy output.mpg

    This one works nearly, but "-r 4" makes video go slow and audio goes ahead. If I use "-r 5" then audio goes slow, and video goes ahead :

    ffmpeg -r 4 -i img%d.png -i audio.wav -acodec copy -r 30 output.mpg
  • Gstreamer AAC encoding no more supported ?

    22 juillet 2016, par Gianks

    i’d like to include AAC as one of the compatible formats in my app but i’m having troubles with its encoding.
    FAAC seems to be missing in GStreamer-1.0 Debian-derived packages (see Ubuntu) and the main reason for that (if i got it correctly) is the presence of avenc_aac (Lunchpad bugreport) as a replacement.

    I’ve tried the following :

    gst-launch-1.0 filesrc location="src.avi" ! tee name=t  t.! queue ! decodebin ! progressreport ! x264enc ! mux. t.! queue ! decodebin ! audioconvert ! audioresample ! avenc_aac compliance=-2 ! mux. avmux_mpegts name=mux ! filesink location=/tmp/test.avi

    It hangs prerolling with :

    ERROR libav :0:: AAC bitstream not in ADTS format and extradata missing

    Using mpegtsmux instead of avmux_mpegts seems to work since the file is created but it results with no working audio (with some players it’s completely unplayable).

    This is the trace of mplayer :

    Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
    [aac @ 0x7f2860d6c3c0]channel element 3.15 is not allocated
    [aac @ 0x7f2860d6c3c0]Sample rate index in program config element does not match the sample rate index configured by the container.
    [aac @ 0x7f2860d6c3c0]Inconsistent channel configuration.
    [aac @ 0x7f2860d6c3c0]get_buffer() failed
    [aac @ 0x7f2860d6c3c0]Assuming an incorrectly encoded 7.1 channel layout instead of a spec-compliant 7.1(wide) layout, use -strict 1 to decode according to the specification instead.
    [aac @ 0x7f2860d6c3c0]Reserved bit set.
    [aac @ 0x7f2860d6c3c0]Number of bands (20) exceeds limit (14).
    [aac @ 0x7f2860d6c3c0]invalid band type
    [aac @ 0x7f2860d6c3c0]More than one AAC RDB per ADTS frame is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
    [aac @ 0x7f2860d6c3c0]Reserved bit set.
    [aac @ 0x7f2860d6c3c0]Number of bands (45) exceeds limit (28).
    Unknown/missing audio format -> no sound
    ADecoder init failed :(
    Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
    FAAD: compressed input bitrate missing, assuming 128kbit/s!
    AUDIO: 44100 Hz, 2 ch, floatle, 128.0 kbit/9.07% (ratio: 16000->176400)
    Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
    ==========================================================================
    AO: [pulse] 44100Hz 2ch floatle (4 bytes per sample)
    Starting playback...
    FAAD: error: Bitstream value not allowed by specification, trying to resync!
    FAAD: error: Invalid number of channels, trying to resync!
    FAAD: error: Invalid number of channels, trying to resync!
    FAAD: error: Bitstream value not allowed by specification, trying to resync!
    FAAD: error: Invalid number of channels, trying to resync!
    FAAD: error: Bitstream value not allowed by specification, trying to resync!
    FAAD: error: Channel coupling not yet implemented, trying to resync!
    FAAD: error: Invalid number of channels, trying to resync!
    FAAD: error: Invalid number of channels, trying to resync!
    FAAD: error: Bitstream value not allowed by specification, trying to resync!
    FAAD: Failed to decode frame: Bitstream value not allowed by specification
    Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
    VO: [vdpau] 640x480 => 640x480 Planar YV12
    A:3602.2 V:3600.0 A-V:  2.143 ct:  0.000   3/  3 ??% ??% ??,?% 0 0
    FAAD: error: Array index out of range, trying to resync!
    FAAD: error: Bitstream value not allowed by specification, trying to resync!
    FAAD: error: Bitstream value not allowed by specification, trying to resync!
    FAAD: error: Unexpected fill element with SBR data, trying to resync!
    FAAD: error: Bitstream value not allowed by specification, trying to resync!
    FAAD: error: Bitstream value not allowed by specification, trying to resync!
    FAAD: error: Channel coupling not yet implemented, trying to resync!
    FAAD: error: Invalid number of channels, trying to resync!
    FAAD: error: PCE shall be the first element in a frame, trying to resync!
    FAAD: error: Invalid number of channels, trying to resync!
    FAAD: Failed to decode frame: Invalid number of channels
    A:3602.2 V:3600.1 A-V:  2.063 ct:  0.000   4/  4 ??% ??% ??,?% 0 0

    These the messages produced by VLC (10 seconds of playback) :

    ts info: MPEG-4 descriptor not found for pid 0x42 type 0xf
    core error: option sub-original-fps does not exist
    subtitle warning: failed to recognize subtitle type
    core error: no suitable demux module for `file/subtitle:///tmp//test.avi.idx'
    avcodec info: Using NVIDIA VDPAU Driver Shared Library 361.42 Tue Mar 22 17:29:16 PDT 2016 for hardware decoding.
    core warning: VoutDisplayEvent 'pictures invalid'
    core warning: VoutDisplayEvent 'pictures invalid'
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio warning: ADTS CRC not supported
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio warning: ADTS CRC not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio warning: Invalid ADTS header
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
    packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported

    Using the error of the hanging pipeline I’ve finally discovered that avenc_aac should be told in such way to output the data NOT in RAW AAC but in ADTS AAC, the point is that i’ve no idea how to do that with Gstreamer. See here, bottom of the page : FFMPEG Ticket

    At this point since i’ve found no documentation seems right to say we have no support for AAC encoding in GStreamer... which isn’t true, i guess ! (IMHO anyway seems strange the missing of FAAC if AVENC_AAC requires all the time to be set in experimental mode)

    Can someone propose a working pipeline for this ?

    UPDATE

    After some more research i’ve found (via gst-inspect on avenc_aac) what i’m probably looking for but i don’t know how to setup it as needed.
    Have a look at stream-format :

    Pad Templates:
     SRC template: 'src'
       Availability: Always
       Capabilities:
         audio/mpeg
                  channels: [ 1, 6 ]
                      rate: [ 4000, 96000 ]
               mpegversion: 4
             stream-format: raw
           base-profile: lc

    Thanks