Problem using avconv to convert .mp4 to .webm

8,105

finally for some have interest, i use these commands to convert some type of video files:

avconv -i "$videoname".AVI -b 2048k -r 30 -c:a libmp3lame "$videoname".mp4
avconv -i "$videoname".AVI -c:v libx264 -ar 44100 -y "$videoname".flv
avconv -i "$videoname".mp4 -y "$videoname".webm

with these three steps i can embed correctly with my script.

Share:
8,105

Related videos on Youtube

johnny cravatta
Author by

johnny cravatta

Updated on September 18, 2022

Comments

  • johnny cravatta
    johnny cravatta over 1 year

    I'll try to describe my situation:

    I have an android phone makes video in mp4 format. I like to share this video on my web page and jwplayer. Such that operates well. I use one script to make all and all works fine. I use to convert the file in webm,and Inserting in jwplayer with this type of embedding code:

     <div id="player" align="center">
    <script src="jwplayer.js" type="text/javascript"></script>
    
     <script type="text/javascript"> jwplayer("player").setup({
         height: 270,
         image: "thumb.png",
         levels: [
             {file: 'file.mp4', type: 'video/mp4' },
             {file: 'file.webm', type: 'video/webm' },
         ],
         modes: [
             { type: 'html5' },
             { type: 'flash', src: 'player.swf' }
         ],
         width: 480 }); </script></div>
    

    to convert from mp4 to webm i use simply this command:

    avconv -i "$file".mp4 "$file".webm
    

    OK! Now the problem is with my new photo camera. My pentax makes video in AVI and in this case to embedding with my jwplayer I need one mp4 and one webm file.

    OK I use this command:

    avconv -i "$videoname".AVI -c:v libx264 -crf 23 -c:a libfaac -b:a 192k "$videoname".mp4
    

    the results are positive.

    Now if i use to convert this new mp4 in webm with:

    avconv -i "$file".mp4 "$file".webm
    

    the webm file doesn't work....

    example ffprobe with the avi file:

    $ ffprobe IMGP0129.AVI 
    avprobe version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2007-2012 the Libav               
    developers
      built on Nov  6 2012 16:51:33 with gcc 4.6.3
    Input #0, avi, from 'IMGP0129.AVI':
      Duration: 00:00:44.64, start: 0.000000, bitrate: 27089 kb/s
        Stream #0.0: Video: mjpeg, yuvj420p, 1280x720, 30.08 tbr, 30.08 tbn, 30.08 tbc
        Stream #0.1: Audio: pcm_u8, 32000 Hz, 1 channels, u8, 256 kb/s
    

    example of error message for the webm in output:

    $ avconv -i output.mp4 out2.webm
    avconv version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav
    developers
     built on Nov  6 2012 16:51:33 with gcc 4.6.3
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf53.21.0
     Duration: 00:00:04.99, start: 0.000000, bitrate: 2228 kb/s
       Stream #0.0(und): Video: h264 (Main), yuvj420p, 1280x720, 2193 kb/s, 30.01 fps,
    30.01 tbr, 500k tbn, 60.01 tbc
       Stream #0.1(und): Audio: aac, 32000 Hz, mono, s16, 54 kb/s
    Incompatible pixel format 'yuvj420p' for codec 'libvpx', auto-selecting format 'yuv420p'
    [buffer @ 0x2345340] w:1280 h:720 pixfmt:yuvj420p
    [avsink @ 0x2356540] auto-inserting filter 'auto-inserted scaler 0' between the filter
    'src' and the filter 'out'
    [scale @ 0x2343220] w:1280 h:720 fmt:yuvj420p -> w:1280 h:720 fmt:yuv420p flags:0x4
    [libvpx @ 0x23468a0] v1.0.0
    Output #0, webm, to 'out2.webm':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf53.21.0
        Stream #0.0(und): Video: libvpx, yuv420p, 1280x720, q=-1--1, 200 kb/s, 1k tbn,
    30.01 tbc
        Stream #0.1(und): Audio: libvorbis, 32000 Hz, mono, s16
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 -> libvpx)
      Stream #0:1 -> #0:1 (aac -> libvorbis)
    Press ctrl-c to stop encoding
    **[webm @ 0x2344de0] Application provided invalid, non monotonically increasing dts to
    **muxer in stream 0: 33 >= 33**
    **strong text**av_interleaved_write_frame(): Invalid argument**
    

    Any suggestions?

    • Davisein
      Davisein over 11 years
      I have been struggling with several problems similar lately. Can you add the error message? Can you add the format ffprobe "$videoname".avi gives to you?
    • johnny cravatta
      johnny cravatta over 11 years
      ok i'm going to update question
    • Davisein
      Davisein over 11 years
      Have you tried putting this --rtmp-liveradio-opts --live. I saw it here: ffmpeg.org/pipermail/ffmpeg-user/2011-June/001315.html
    • johnny cravatta
      johnny cravatta over 11 years
      thanks davisein but this option is used with live streams "rtmp". lists.infradead.org/pipermail/get_iplayer/2011-May/001504.ht‌​ml
    • Davisein
      Davisein over 11 years
      My bad, shame on me :( I was looking for some workaround for you as you had a different problem than me ;)
  • phoibos
    phoibos over 11 years
    Just to be nitpicking: You should use the original avi source for the conversion to webm for maximum quality.
  • johnny cravatta
    johnny cravatta about 11 years
    @phoibos,thanks for the suggest, but i'm unable to find correct avconv options to converto directly from avi to webm, can you post some verifyed examples, please.i have tried with "avcvonv -i video.avi -y video.webm" dont'work
  • v010dya
    v010dya over 9 years
    @johnnycravatta Have you tried avconv -i video.AVI -sn -y video.webm?
  • v010dya
    v010dya over 9 years
    @johnnycravatta If that doesn't work, you should consider posting somewhere an example of your avi file, so that people can try.