|
|
Hi all,
last night I did a 2-pass encoding of a movie using mencoder under linux. As I want to mux it into a matroska container, I tried to convert it to .mp4 first, as I did not want to use quot;--engage allow_avc_in_vfw_modequot; with mkvmerge. Btw, the movie is encoded in x264.
So I did this (I guess here is the error):
Code:
$ MP4Box -aviraw video 2ndpass.x264
[avilib] Reconstructing index...Extracting AVI video (format h264) to 2ndpass_video.h264
After that I use
Code:
$ MP4Box -add 2ndpass_video.h264 movie.mp4
Adjusting AVC SizeLength to 16 bits
AVC-H264 import - frame size 704 x 416 at 25.000 FPS
Adjusting AVC SizeLength to 24 bits67/100)
Import results: 95606 samples - Slices: 2574 I 79708 P 108930 B - 1 SEI - 2244 IDR Stream uses B-slice references - max frame delay 2
Saving to movie.mp4: 0.500 secs Interleaving
to create an .mp4 file. But this is not the complete movie, only a little more than one hour, instead of 3h20mins (see the number of frames, also later for 1st pass).
I tried several versions of gpac, including the latest cvs; none worked. But what I found very interesting was that it did work with the file from the first pass.
Here are a few details:
Code:
$ MP4Box -aviraw video 1stpass.x264
Extracting AVI video (format h264) to 1stpass_video.h264
and
Code:
$ MP4Box -add 1stpass_video.h264 movie.mp4
Adjusting AVC SizeLength to 16 bits
AVC-H264 import - frame size 704 x 416 at 25.000 FPS
Import results: 299608 samples - Slices: 8390 I 246676 P 344150 B - 1 SEI - 7322 IDR Stream uses B-slice references - max frame delay 2
Saving movie.mp4: 0.500 secs Interleaving
As you can see quot;[avilib] Reconstructing index...quot; only shows up for the second pass.
Last but not least, I want to list only the differences in the x264 encoding options of the two passes:
firstpass:
Code:
me=2:subq=4:frameref=2:trellis=1:pass=1
second pass:
Code:
me=3:subq=5:frameref=3:trellis=2:pass=2:bitrate=2250
Any help is greatly appreciated!
R!tman
Maybe you are hitting some 2 GB file size limit, either in the filesystem if you are using an old FAT partition, or as a bug in MP4Box/gpac. You don't seem to be specifying bitrate for the first pass (you should give it the same bitrate as in the second pass, by the way), so the file is probably significantly smaller.
Originally Posted by nmMaybe you are hitting some 2 GB file size limit, either in the filesystem if you are using an old FAT partition, or as a bug in MP4Box/gpac. You don't seem to be specifying bitrate for the first pass (you should give it the same bitrate as in the second pass, by the way), so the file is probably significantly smaller.
nm, thank you for your answer! Indeed the 1st pass file is much smaller as you can see here:
Code:
$ du -sh *.x264
918M 1stpass.x264
3.2G 2ndpass.x264
As I am using reiserfs, I doubt it's the filesystem.
I will try to reencode the movie this night with quot;bitratequot; in both passes. But this will most probably not solve the problem, as for MP4Box the faulty one seems to be the 2nd pass, not the 1st.
mencoder cannot output raw h264?
Originally Posted by GodofaGapmencoder cannot output raw h264?
GodofaGap, well, I just learned it can using quot;-of rawvideoquot;.
Unfortunately, a quick test with
Code:
mencoder -o 2ndpass_new.x264 -ovc copy -nosound -of rawvideo 2ndpass.x264
did not work either.
But, as I will have to reencode the whole thing again anyway (because I forgot to include quot;bitratequot; in the first pass), I hope this will solve the problem.
On the other hand, this still does not solve the problem MP4Box has with that file.[edit]
Directly adding the raw video produces this:
Code:
$ MP4Box -add 2ndpass_new.x264 movie.mp4(Feature Not Supported)Unknown input file type
Error importing 2ndpass_new.x264: Feature Not Supported
And a new encoding like this
Code:
mencoder -of rawvideo -o test.avi -ovc x264 -x264encopts bitrate=2250 -nosound -ss 00:02:00 -endpos 00:00:10 2ndpass.x264
results in this (latest gpac-cvs and gpac-0.4.1):
Code:
$ MP4Box -add test.avi movie.mp4
*** glibc detected *** double free or corruption (top): 0x000000000051c470 ***
Aborted
[/edit]
As I mangaged to get my hands on a friend's M$ (windows, that is) laptop, I did some testing there with MP4Box.exe. I used the same version as I did with linux, which is
Code:
$ MP4Box -version
MP4Box - GPAC version 0.4.1-DEV
GPAC Copyright: (c) Jean Le Feuvre 2000-2005 (c) ENST 2005-200X
Creating an .mp4 file under windows and playing it with mplayer in Linux resulted (after the first hour of the movie, which works fine) in a whole bunch of these errors:
Code:
[h264 @ 0xb1dd10]AVC: Consumed only 13622 bytes instead of 8119477
[h264 @ 0xb1dd10]Unknown NAL code: 15
The quot;NAL codesquot; I have seen are: 0, 14, 15, 20, 21, 22, 23, 25, 26, 29
Furthermore, the raw video created with windows is bigger (3220MB) than the one from Linux (1023MB). Trying to create an .mp4 file in Linux with the raw video file created in windows results in this error:
Code:
$ MP4Box -add 2ndpass_video.h264 video.mp4
Adjusting AVC SizeLength to 16 bits
AVC-H264 import - frame size 704 x 416 at 25.000 FPS
Adjusting AVC SizeLength to 24 bits21/100)
MP4Box: media_import.c:3578: gf_import_h264: Assertion `nal_start' failed.
Aborted
I hope some more information will help, and not scare you off...
When creating the raw video file in windows (the one that is bigger than in linux), I do not get quot;[avilib] Reconstructing index...quot;.
This is what I get when creating the .mp4 file in windows (from the raw video also created in windows)
Code:
MP4Box.exe -add 2ndpass_video.h264 video2.mp4
Adjusting AVC SizeLength to 16 bits
AVC-H264 import - frame size 704 x 416 at 25.000 FPS
Adjusting AVC SizeLength to 24 bits21/100)
Import results: 299608 samples - Slices: 8390 I 246676 P 344150 B - 1 SEI - 7322IDR Stream uses B-slice references - max frame delay 2
Saving to video2.mp4: 0.500 secs Interleaving
And the last thing: trying to create an .mp4 file in windows from a raw video created directly from mplayer (using -vf rawvideo) in linux also did not work.
HELP!
Hi, it's me again!
This night I reencoded the movie again, this time with quot;bitratequot; also in the first pass. Now, MP4Box has troubles with the files from both passes. They are both 3.2GB now.
Peculiar is that both fail at 1023MB, which made me think about the RIFF chunks every 1023MB mplayer creates. I found something in the forum:
archive/index.php/t-89842.html
Unfortunately, the solution posted there
Code:
mencoder -ovc copy -nosound -noodml -o 2ndpass_noodml.x264 2ndpass.x264
does not work for me.
Using that, the raw video file is also 3.2GB, but creating an .mp4 file from it fails at 63%. 63% of 3.2GB is approximately 2024MB - interesting...
Anyone?
So you didn't get the raw output from Mencoder working since you are still using AVI?
Originally Posted by nmSo you didn't get the raw output from Mencoder working since you are still using AVI?
nm, no that's not how it is.
I DID get the raw output from mencoder working, but I could not use that file together with MP4Box.
This is what I used to get raw output for an example file
Code:
$ mencoder -of rawvideo dvd--3 -ovc x264 -x264encopts bitrate=2000 -nosound -o 3.raw
And this is what I got with MP3Box
Code:
$ MP4Box -add 3.raw asdf.mp4(Feature Not Supported)Unknown input file type
Error importing 3.raw: Feature Not Supported
So, as MP4Box does not play nicely with raw output from mencoder I am back on the original task. That's why I still use avi output and try to get MP4Box to work.
mp4box does file type detection by extension IIRC (yes, pretty lame ).
Rename the file to 3.264 or 3.h264.
As is said in the MP4Box manual, you need to use the proper file extension for the raw files: .h264, .h26L, .264 or .26L. Otherwise MP4Box doesn't know what kind of files it is dealing with.
Originally Posted by GodofaGapmp4box does file type detection by extension IIRC (yes, pretty lame ).
Rename the file to 3.264 or 3.h264.Originally Posted by nmAs is said in the MP4Box manual, you need to use the proper file extension for the raw files: .h264, .h26L, .264 or .26L. Otherwise MP4Box doesn't know what kind of files it is dealing with.
@GodofaGap, nm: You are both right. MP4Box checks extensions.
@me: RTFM!
Thanks to you, I can now use mplayer output directly with MP4Box. Unfortunately, I still get this error:
Code:
$ MP4Box -add 2ndpass.h264 video.mp4
Adjusting AVC SizeLength to 16 bits
AVC-H264 import - frame size 704 x 416 at 25.000 FPS
MP4Box: media_import.c:3578: gf_import_h264: Assertion `nal_start' failed.
Aborted
It is aborted at ~63% again. I assume it has something to do with the 2GB which is approximately 63% of 3.2GB (filesize of the raw video).
I am pretty sure it's not the filesystem, otherwise I would hardly have the raw video file.
Any ideas, again?
I know mplayer has a --enable-largefiles configure flag (for files larger than 2GB)... perhaps that is it?
Originally Posted by GodofaGapI know mplayer has a --enable-largefiles configure flag (for files larger than 2GB)... perhaps that is it?
GodofaGap, this already is part of my compile flags.
Then I'm out of ideas regarding that...
I assume small files (lt;2GB) work? You could also try to pipe from mencoder to x264-cli perhaps? A bit tedious... I know...
hm... could we encoded it to 2 parts, and join them when produce MKV? the append function in mkvmerge should work...
Originally Posted by GodofaGapThen I'm out of ideas regarding that...
I assume small files (lt;2GB) work? You could also try to pipe from mencoder to x264-cli perhaps? A bit tedious... I know...
GodofaGap, yes, smaller files work. I just tried a 2068MB file, encoded with quot;-noodml -of rawvideoquot;. It fails at 99%. I am pretty sure now it's that 2GB thing.
Question remains: What causes that? Mpayer or MP4Box?
Originally Posted by MeteorRainhm... could we encoded it to 2 parts, and join them when produce MKV? the append function in mkvmerge should work...
MeteorRain, actually, the movie is made up of 48 different smaller ones. It took me a hell of a lot time to put them together into one single video and, most importantly, in sync with the two sound streams. Furthermore, I joined the small file to one big in order to achieve a better overall bitrate usage of the whole movie.
(Imaging joining an action movie and a cartoon, each encoded individually with the same bitrate. The action movie would have the same bitrate, but lower quality than the cartoon. I hope you know what I mean...)
In essence, I will only reencode in two different parts if it's absolutly neccessary.
But I will consider, better try out right now, to cut the movie, create an .mp4 file and mux everything into .mkv.
Well, after dinner :-).
EDIT: I have to admin that I'd like a working MP4Box or mplayer (whatever causes the problem) much better than having to split and merge into .mkv...
try another muxer, like mp4creator and avc2avi and check if those work, cause then we see if its a mp4box bug or not
moved
Originally Posted by bondtry another muxer, like mp4creator and avc2avi and check if those work, cause then we see if its a mp4box bug or not
moved
bond, actually, I did try mp4creator. But as I did not manage to get it to work at all, I thought it was just stupid me not understanding the mp4creator syntax. So I dropped it. This is what I tested:
With the raw video stream:
Code:
$ rm test.mp4 amp;amp; mp4creator -use64bits -rate=25 -verbose=2 2ndpass_noodml_raw.mp4v test.mp4
Write: type ftyp
Write: majorBrand = mp42
Write: minorVersion = 0 (0x00000000)
Write: Write: brand = mp42brand = isom
Write: finished ftyp
mp4creator: buffer overflow, invalid video stream?
Segmentation fault
In the man page it says
Originally Posted by man mp4creator...
These original media files are known as elementary stream (ES) files in MPEG parlance.
...
I did not really know what that meant, but I did this
Code:
mencoder -of mpeg -ovc copy -nosound -o 2ndpass_noodml_mpeg.mp4v 2ndpass.x264
to ensure the movie would be in an mpeg container.
I got this then:
Code:
$ rm test.mp4 amp;amp; mp4creator -verbose=2 -use64bits -rate=25 2ndpass_noodml_mpeg.mp4v test.mp4
Write: type ftyp
Write: majorBrand = mp42
Write: minorVersion = 0 (0x00000000)
Write: Write: brand = mp42brand = isom
Write: finished ftyp
mp4creator: no VOSH header found in MPEG-4 video.
This can cause problems with players other than mp4player.
mp4creator: No VO header found in mpeg-4 video.
This can cause problems with players other than mp4player
mp4creator: fatal: No VOL header found in mpeg-4 video stream
Write: type moov
Write: type mvhd
Write: version = 0 (0x00)
Write: flags = 0 (0x000000)
Write: creationTime = 3224865677 (0xc0378b8d)
Write: modificationTime = 3224865677 (0xc0378b8d)
Write: timeScale = 90000 (0x00015f90)
Write: duration = 0 (0x00000000)
Write: rate = 1.000000
Write: volume = 1.000000
Write: reserved1 = lt;70 bytesgt;00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Write: nextTrackId = 1 (0x00000001)
Write: finished mvhd
Write: type iods
Write: version = 0 (0x00)
Write: flags = 0 (0x000000)
Write: objectDescriptorId = 1 (0x001) lt;10 bitsgt;uclFlag = 0 (0x0) lt;1 bitsgt;includeInlineProfileLevelFlag = 0 (0x0) lt;1 bitsgt;reserved = 15 (0xf) lt;4 bitsgt;ODProfileLevelId = 255 (0xff)sceneProfileLevelId = 255 (0xff)audioProfileLevelId = 255 (0xff)visualProfileLevelId = 255 (0xff)graphicsProfileLevelId = 255 (0xff)esIdsociDescripmpDescrPtrextDescr
Write: finished iods
Write: finished moov
Maybe it IS just me, please post a correct command line then.
I have not tested avc2avi, yet. This, I will do right now...
I think mp4creator thinks your file is MPEG4 ASP... why did you change the extension to mp4v? Just use the raw file with a normal extension (e.g. .264)... |
|