I need to put the video and audio streams of an MKV file into an MP4 container. So I tried:
But, what I get is this error message:Code:$ ffmpeg -i video.mkv -vcodec copy -acodec copy video.mp4
Does ffmpeg fail putting AC3 into the MP4 container? I know, initially MP4 did not support AC3 streams, but over a year ago they officially allowed AC3 to be enclosed in an MP4 (see http://en.wikipedia.org/wiki/Comparison_of_container_formats). So I expect ffmpeg to be aware of that and fulfill my wish!Code:Could not write header for output file #0 (incorrect codec parameters ?)
Do I have to to specify any parameters to pack AC3 into MP4?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 20 of 20
Thread
-
-
I compiled it from SVN (SVN-r20255) just three days ago:
Code:$ ffmpeg -version FFmpeg version SVN-r20255, Copyright (c) 2000-2009 Fabrice Bellard, et al. built on Oct 17 2009 02:49:24 with gcc 4.2.1 (Apple Inc. build 5646) configuration: --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-gpl --enable-libxvid --enable-libx264 --enable-nonfree --enable-libfaac --enable-libfaad libavutil 50. 3. 0 / 50. 3. 0 libavcodec 52.37. 0 / 52.37. 0 libavformat 52.39. 2 / 52.39. 2 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0. 7. 1 / 0. 7. 1 FFmpeg SVN-r20255 libavutil 50. 3. 0 / 50. 3. 0 libavcodec 52.37. 0 / 52.37. 0 libavformat 52.39. 2 / 52.39. 2 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0. 7. 1 / 0. 7. 1
-
I'd prefer to use ffmpeg :/
Here is the complete output:
Code:$ ffmpeg -i video.mkv -vcodec copy -acodec copy video.mp4 FFmpeg version SVN-r20255, Copyright (c) 2000-2009 Fabrice Bellard, et al. built on Oct 17 2009 02:49:24 with gcc 4.2.1 (Apple Inc. build 5646) configuration: --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-gpl --enable-libxvid --enable-libx264 --enable-nonfree --enable-libfaac --enable-libfaad libavutil 50. 3. 0 / 50. 3. 0 libavcodec 52.37. 0 / 52.37. 0 libavformat 52.39. 2 / 52.39. 2 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0. 7. 1 / 0. 7. 1 Seems stream 0 codec frame rate differs from container frame rate: 59.94 (60000/1001) -> 29.97 (30000/1001) Input #0, matroska, from 'video.mkv': Duration: 00:03:14.59, start: 0.000000, bitrate: N/A Stream #0.0(eng): Video: h264, yuv420p, 720x480, PAR 8:9 DAR 4:3, 29.97 tbr, 1k tbn, 59.94 tbc Stream #0.1(eng): Audio: ac3, 48000 Hz, 6 channels, s16 Stream #0.2(eng): Audio: ac3, 48000 Hz, 2 channels, s16 Stream #0.3(eng): Audio: ac3, 48000 Hz, 2 channels, s16 Stream #0.4(eng): Audio: ac3, 48000 Hz, 2 channels, s16 File 'video.mp4' already exists. Overwrite ? [y/N] y [mp4 @ 0x1076800]track 1: codec frame size is not set Output #0, mp4, to 'video.mp4': Stream #0.0(eng): Video: libx264, yuv420p, 720x480 [PAR 8:9 DAR 4:3], q=2-31, 1k tbn, 1k tbc Stream #0.1(eng): Audio: ac3, 48000 Hz, 6 channels, s16 Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Could not write header for output file #0 (incorrect codec parameters ?)
-
Try add
-f mp4 -r 29.970 -s 720x400 -aspect 4:3
and see if it makes any difference. -
Thanks for your help, but I get exactly the same error message :/
Code:Could not write header for output file #0 (incorrect codec parameters ?)
-
Originally Posted by thuriel
-s 720x480
my advices will be to change audio file format (AC3 in .mp4 is not well handle by most players), prefer aac
and add a "h264 magic cleaner"
->
Code:ffmpeg -i video.mkv -s 720x480 -vcodec copy -vbsf h264_mp4toannexb -acodec aac -ab 384k -y video.mp4
byeFor DVD, iPad, HD, connected TV, … iMovie & FCPX? MovieConverter-Studio 3 (01/24/2015) - Handle your camcorder's videos? even in 60p or 60i? do a slow-motion? MovieCam. -
Thanks, Herve. I do not want to transcode the audio stream because of quality loss. And since the MP4 container officially supports AC3 I think this should be possible.
I specified the framesize and added this "magic cleaner". Still get the same error message ("Could not write header for output file #0 (incorrect codec parameters ?)"). I assume that ffmpeg is not able to process AC3 in MP4.
Even when I try to transcode my AC3 to AAC I get errors:
Code:$ ffmpeg -i video.mkv -f mp4 -r 29.970 -s 720x480 -aspect 4:3 -vcodec copy -vbsf h264_mp4toannexb -acodec aac -ab 384k -y video.mp4 ... [NULL @ 0x1077800]error, non monotone timestamps 567 >= 300 av_interleaved_write_frame(): Error while opening file
Anyway, thanks for all your help. And, pepegot1, there is no Mac version of WinFF, but thanks anyway. -
Originally Posted by thuriel
Even when I try to transcode my AC3 to AAC I get errors:
Code:[NULL @ 0x1077800]error, non monotone timestamps 567 >= 300
Code:av_interleaved_write_frame(): Error while opening file
you could try to wrap it again with VLC (no transcode, just to wrap again audio and video, values should be continuous now)
byeFor DVD, iPad, HD, connected TV, … iMovie & FCPX? MovieConverter-Studio 3 (01/24/2015) - Handle your camcorder's videos? even in 60p or 60i? do a slow-motion? MovieCam. -
Originally Posted by thuriel
support wrapping AC3 in the MP4 container. And AFAIK, only the MPC-HC MP4 splitter
is able to detect AC3 and connect it to an AC3 decoder.
Sadly the official specs do not guarantee that a feature that should be implemented
will actually be implemented. Today MP4 "officially" supports AC3, DTS, and VC-1, but...
so what? -
Originally Posted by Herve
Originally Posted by Herve
Originally Posted by El Heggunte -
Originally Posted by thuriel
-
Originally Posted by thuriel
- QuickTime first loads your mkv (slow) and build its own private index only available by QuickTime (so you don't have to care with broken files)
- VLC and Mplayer are real-time streaming softwares, so they accept broken files. They uses Presentation"timecodes"(PTS) and Display"TimeCode"(DTS) to manage to display the stream and keep synch, even if the file is not full (a hole in its middle).
But FFmepg is not a real-time streaming software, it wants continuous PTS = a valid video file
byeFor DVD, iPad, HD, connected TV, … iMovie & FCPX? MovieConverter-Studio 3 (01/24/2015) - Handle your camcorder's videos? even in 60p or 60i? do a slow-motion? MovieCam. -
It's an old thread, but I just had the same problem.
I also received the message "ffmpeg codec frame size is not set".
With a little playing around, I extracted the following: "Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'" -- my ac3 file had sample format s16.
The solution was to specify -c:a ac3 or -acodec ac3, not -c:a copy or -acodec copy (even though the final product has the exact same format/same bitrate/same sample rate). This let ffmpeg auto-"correct" the sample format from s16 to flt. -
(message deleted)
Edit : oops! I didn't notice that it was an old thread (so my "previous and deleted answer" has no more interest. Next time I will finish to read the topic before answering )For DVD, iPad, HD, connected TV, … iMovie & FCPX? MovieConverter-Studio 3 (01/24/2015) - Handle your camcorder's videos? even in 60p or 60i? do a slow-motion? MovieCam. -
about your warnings:
it's a warning (not an error)
you didn't say which channel order you want, so ffmpeg use its default one (and warn it to you)
PS:"ffmpeg codec frame size is not set"
- an error in parameters
- an argument forgotten (eg: the video size argument, but not always: it will be too simple to understand these messages )
byeFor DVD, iPad, HD, connected TV, … iMovie & FCPX? MovieConverter-Studio 3 (01/24/2015) - Handle your camcorder's videos? even in 60p or 60i? do a slow-motion? MovieCam.
Similar Threads
-
How put the subtitel in FFmpeg (pfffff)
By cane in forum ffmpegX general discussionReplies: 12Last Post: 17th Nov 2011, 08:54 -
Converting everything to mp4 using ffmpeg
By euphonic in forum Video ConversionReplies: 1Last Post: 13th May 2011, 07:53 -
ffmpeg help... convert mp4 to jpeg array, and back to mp4 - problem!
By SaskVideoMaker in forum Video ConversionReplies: 2Last Post: 4th Feb 2011, 04:53 -
Help with FFmpeg .TS to .mp4
By ViM in forum Video ConversionReplies: 2Last Post: 15th Nov 2010, 10:39 -
Where do I put the ffmpeg 5.0 at on my comp?
By HaukkeIV in forum Newbie / General discussionsReplies: 1Last Post: 20th Feb 2010, 01:00