Ask Ubuntu Asked by ColLeslieHapHapablap on November 19, 2021
I am trying to convert an MKV file to MP4 to be compatible with my PS3. I am using:
avconv -i file.mkv -c copy file.mp4
It fails and I get the following error:
[mp4 @ 0x8a17c00] pts < dts in stream 0
av_interleaved_write_frame(): Invalid argument
The file is h264 video and ac3 audio.
You can use winff-gtk2 it solved my the problem! To install:
sudo apt install winff-gtk2.
Answered by Joao Bortoletto on November 19, 2021
I was looking for muxing mp4 along with m4a. The usual ffmpeg commands for encoding didn't worked.Tried MP4Box & it worked like a charm. :-)
Answered by kkdeep on November 19, 2021
sudo apt-get install gpac mkvtoolnix
First you need to check what tracks the matroska file contains with
mkvmerge --identify video.mkv
File 'video.mkv': container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AC3)
Then extract video and audio according to their tracks with:
mkvextract tracks video.mkv 1:video.h264 2:audio.ac3
Extracting track 1 with the CodecID 'V_MPEG4/ISO/AVC' to the file 'video.h264'. Container format: AVC/h.264 elementary stream
Extracting track 2 with the CodecID 'A_AC3' to the file 'audio.ac3'. Container format: Dolby Digital (AC3)
Progress: 100%
MP4Box -fps 24 -add video.h264 -add audio.ac3 video.mp4
AVC-H264 import - frame size 1280 x 720 at 24.000 FPS
Import results: 31671 samples - Slices: 5672 I 125048 P 122648 B - 32288 SEI - 4936 IDR
AC3 import - sample rate 48000 - 6 channels
Saving to video.mp4: 0.500 secs Interleaving
I had to add -fps 24
option because MP4Box
didn't detect video fps correctly. Depending on usage AC3
audio track should be re-encoded into something else before muxing.
Now you have remuxed streams from matroska container into mp4 container without losing any quality.
EDIT: MP4 doesn't officially support AC3 audio so the audio track should be converted into a supported format (eg. AAC, MP3) if you want the file to be playable with something else than VLC.
Answered by stampede on November 19, 2021
I believe that
avconv -i file.mkv -c:v copy -c:a copy file.mp4
is the correct command. You need to specify the codec copy property for the streams you want to copy separately.
Answered by ixtmixilix on November 19, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP