Fawkes
Fawkes

Reputation: 43

Transcoding wmv file to mp4 using Jave

I am trying to use Jave to convert a wmv file into h264(mp4). The final version created by Jave plays fine with VLC player but when I try to use it inside the HTML5 video tag, it is not able to play the file.

I am guessing that the issue is with the attributes I am setting for the video attributes.

Java Code:

    videoAttributes.setCodec("mpeg4");
    videoAttributes.setTag("mpeg4");
    videoAttributes.setBitRate(new Integer(5000));
    videoAttributes.setFrameRate(new Integer(30));
    videoAttributes.setSize(new VideoSize(512, 384));
    encodingAttributes.setVideoAttributes(videoAttributes);
    encodingAttributes.setFormat("mp4");

HTML code:

    <video controls="true" width=400 height=200>
        <source src="path_to_converted_mp4_file" type="video/mp4" />
        Not Supported
    </video>

Upvotes: 0

Views: 1267

Answers (2)

Mangiucugna
Mangiucugna

Reputation: 1762

According to the JAVE documentation the name of the format is "mp4" not "mpeg4"

Upvotes: 0

sumo
sumo

Reputation: 155

Don't know how Jave identifies codecs but if it uses the same naming as FFmpeg then the codec for HTML5 should be libx264. The mpeg4 codec is "MPEG-4 part 2" according to ffmpeg -codecs.

    ./ffmpeg -codecs | grep -e mpeg4 -e 264
     D V D  h264            H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
     EV    libx264         libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
     EV    libx264rgb      libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB
     DEVSDT mpeg4           MPEG-4 part 2
     DEVSD  msmpeg4         MPEG-4 part 2 Microsoft variant version 3
     D VSD  msmpeg4v1       MPEG-4 part 2 Microsoft variant version 1
     DEVSD  msmpeg4v2       MPEG-4 part 2 Microsoft variant version 2

Upvotes: 1

Related Questions