LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   ffmpeg: converting mp4 to webm (vp8) (https://www.linuxquestions.org/questions/linux-software-2/ffmpeg-converting-mp4-to-webm-vp8-904648/)

hydraMax 09-23-2011 11:55 AM

ffmpeg: converting mp4 to webm (vp8)
 
Hi. I'm no expert at video transcoding, but I have this project where I am transcoding 3gp videos from my cellphone into webm files that I can embed on my Web site. I managed to extract the mpeg4 video from all the 3gp files (don't need the audio) and put them into .mp4 files using ffmpeg and a ruby script. Then I figured out that vlc has a cool "convert" menu that allows me to convert an mp4 file into a VP8/Webm file, which worked great.

However, I wanted to automate that last step in a script (I have lots of videos to convert). I know that VLC is using ffmpeg, so if I could figure out the raw ffmpeg command I would be able to create the script easily enough. But I can't. After going through the man page I thought it would be something like this:

Code:

ffmpeg -i Android-20110922-VIDEO0015.mp4 -vcodec vp8 -target webm Android-20110922-VIDEO0015.webm
But this dies with:

Code:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Android-20110922-VIDEO0015.mp4':
  Metadata:
    major_brand    : isom
    minor_version  : 512
    compatible_brands: isomiso2mp41
    creation_time  : 1970-01-01 00:00:00
    encoder        : Lavf52.110.0
  Duration: 00:01:11.10, start: 0.000000, bitrate: 232 kb/s
    Stream #0.0(eng): Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 229 kb/s, 40 fps, 40 tbr, 40 tbn, 40 tbc
    Metadata:
      creation_time  : 1970-01-01 00:00:00
Could not determine norm (PAL/NTSC/NTSC-Film) for target.
Please prefix target with "pal-", "ntsc-" or "film-",
or set a framerate with "-r xxx".

If I try to prefix the target like it says (which makes no sense anyway) it does not work and if I try to set the framerate (with -r 40) it brings up the exact same error message.

Does someone know the correct syntax?

H_TeXMeX_H 09-23-2011 12:16 PM

I would omit the '-target' if you can. Specify everything else if you need to.

Why not try vpxenc, there are some examples here:
http://www.webmproject.org/tools/enc..._command_lines

andrew.46 09-24-2011 04:23 AM

The latest FFmpeg has some libvpx presets that might be helpful:

Code:

root@skamandros/home/andrew# find /usr/share -iname 'libvpx*'
/usr/share/ffmpeg/libvpx-720p50_60.ffpreset
/usr/share/ffmpeg/libvpx-720p.ffpreset
/usr/share/ffmpeg/libvpx-360p.ffpreset
/usr/share/ffmpeg/libvpx-1080p50_60.ffpreset
/usr/share/ffmpeg/libvpx-1080p.ffpreset


hydraMax 09-24-2011 04:52 PM

Quote:

Originally Posted by H_TeXMeX_H (Post 4480337)
I would omit the '-target' if you can. Specify everything else if you need to.

Why not try vpxenc, there are some examples here:
http://www.webmproject.org/tools/enc..._command_lines

This worked, after I also omitted the -vcodec part. So in the end I just needed to tell it the name of the input file and the name of the output file, and it figured out the rest.

It's kind of funny that ffmpeg could figure out what I wanted to do based solely on filename extensions, but I couldn't figure out how to tell it what I wanted it to do using exact command line switches.


All times are GMT -5. The time now is 12:56 AM.