7

I am using following command but it is giving wrong output.

ffmpeg -i video.webm -i audio.opus -c:v copy -c:a aac -strict experimental output.mp4

Output:

ffmpeg version 1.2.6-7:1.2.6-1~trusty1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --arch=amd64 --disable-stripping --enable-avresample --enable-pthreads --enable-runtime-cpudetect --extra-version='7:1.2.6-1~trusty1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    53.  5.103 / 53.  5.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, matroska,webm, from 'video.webm':
  Duration: 00:00:04.92, start: 0.000000, bitrate: 243 kb/s
    Stream #0:0: Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 18 fps, 18 tbr, 1k tbn, 1k tbc (default)
Input #1, ogg, from 'audio.opus':
  Duration: 00:00:05.16, start: 0.000000, bitrate: 32 kb/s
    Stream #1:0: Audio: opus, 48000 Hz, stereo, s16
[mp4 @ 0x647940] track 0: could not find tag, codec not currently supported in container
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf54.63.104
    Stream #0:0: Video: vp8, yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 18 fps, 90k tbn, 1k tbc (default)
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (libopus -> aac)
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
bummi
  • 1,703
  • 4
  • 16
  • 28
Anuj
  • 175
  • 1
  • 1
  • 5
  • 1
    Next time when posting about an ffmpeg problem, please include the full, uncut command line output too, not just the command itself. – slhck Feb 04 '15 at 10:03
  • `Operation not permitted` hints at a filesystem permissions issue. – Daniel B Feb 04 '15 at 11:44

3 Answers3

17

WebM containers typically contain VP8 or VP9 video. The MP4 container format however does not support VP8 or VP9 video, at least according to the registration authority.

In your command you are trying to copy the video bitstream, and obviously it will fail:

codec not currently supported in container

You have two options:

  1. Re-code the video to H.264 using -c:v libx264.
  2. Choose another output container like Matroska (.mkv), but note that this will not be compatible for HTML5 video.

See also this MDN reference on supported HTML video formats and this Super User post on how to convert video for HTML5: What bunch of ffmpeg scripts do I need to get HTML5-compatible "Video for everybody"?

slhck
  • 223,558
  • 70
  • 607
  • 592
  • can you help me with the command to convert to any HTML supported video format? – Anuj Feb 04 '15 at 10:10
  • See here: http://superuser.com/questions/424015/what-bunch-of-ffmpeg-scripts-do-i-need-to-get-html5-compatible-video-for-everyb – slhck Feb 04 '15 at 10:12
  • 1
    Thanks I understood what you said. Command I am using now is: `ffmpeg -i video.webm -i audio.opus -c:v copy -c:a libvorbis -strict experimental output.webm` – Anuj Feb 04 '15 at 11:29
  • 1
    Yes, although you should even be able to do `-c:a copy` since WebM supports Opus audio. `-strict experimental` is only needed when using `-c:a aac`. – slhck Feb 04 '15 at 11:55
3
ffmpeg -i video.webm -i audio.opus -c:v copy -c:a aac -strict experimental output.mp4

it should look something like this.

ffmpeg -i audio.opus -i vid.webm  -c:v copy -c:a opus -strict experimental output6.webm

replace aac with opus and the two files around with opus being in front(i think), it should work.

bwDraco
  • 45,747
  • 43
  • 165
  • 205
Ringo_0
  • 31
  • 1
0

A simple command with copy option with the conversion from webm to mp4 doesn't work because of difference in a codec which we don't touch during conversion. It is like simply changing the extension of the input file. To make sure the output is played in H.264 players/televisions use

ffmpeg -y -i "input_video.webm" -i "input_audio.webm" "output_file.mp4"  -c:v libx264 -c:a aac

Note that the execution will be very slow and add -preset veryfast depending on your quality needs. Ref: https://addpipe.com/blog/converting-webm-to-mp4-with-ffmpeg/

Bhakki
  • 1