I want to convert an mp4
file to mkv
with the video format as x264
and audio as libmp3lame
Mediainfo for the file gives:
General Complete name : file_in.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom File size : 404 MiB Duration : 41mn 4s Overall bit rate : 1 375 Kbps Writing application : Lavf56.1.0 Video ID : 1 Format : MPEG-4 Visual Format profile : Advanced Simple@L5 Format settings, BVOP : Yes Format settings, QPel : No Format settings, GMC : No warppoints Format settings, Matrix : Default (H.263) Codec ID : 20 Duration : 40mn 55s Bit rate : 1 185 Kbps Width : 576 pixels Height : 432 pixels Display aspect ratio : 4:3 Frame rate mode : Constant Frame rate : 29.970 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Compression mode : Lossy Bits/(Pixel*Frame) : 0.159 Stream size : 347 MiB (86%) Writing library : XviD 1.3.0.dev55 Audio ID : 2 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : ac-3 Duration : 41mn 4s Bit rate mode : Constant Bit rate : 192 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Bit depth : 16 bits Compression mode : Lossy Stream size : 56.4 MiB (14%)
libx264-dev
andlibav-tools
are the latest versions.I tried converting with the following command
avconv -i file_in.mp4 -c:v libx264 -acodec libmp3lame file_out.mkv
Output of the avconv command was
avconv version 11.2-6:11.2-1, Copyright (c) 2000-2014 the Libav developers built on Jan 18 2015 05:12:33 with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu2) [mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d4c0] multiple edit list entries, a/v desync might occur, patch welcome Last message repeated 1 times [mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d4c0] max_analyze_duration 5000000 reached Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file_in.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf56.1.0 Duration: 00:41:04.99, start: 0.016000, bitrate: 1375 kb/s Stream #0.0(und): Video: mpeg4, yuv420p, 1184 kb/s, 30k tbn (default) Stream #0.1(und): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default) Output #0, matroska, to 'file_out.mkv': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf56.1.0 Stream #0.0(und): Audio: libmp3lame, 48000 Hz, stereo, fltp (default) Metadata: encoder : Lavc56.1.0 libmp3lame Stream mapping: Stream #0:1 -> #0:0 (ac3 (native) -> mp3 (libmp3lame)) size= 315kB time=19.75 bitrate= 130.8kbits/s . . . . size= 39227kB time=2464.97 bitrate= 130.4kbits/s video:0kB audio:38516kB other streams:0kB global headers:0kB muxing overhead: 1.845972%
Essentially only the audio is copied. How do I get the video+audio in mkv
format?
ffmpeg
, but it appears you did not test it (avconv
is not equivalent toffmpeg
).