Hello,
I am basically trying to cut and rejoin different parts from a .mkv encoded with x264/AVC using avidemux. Because I dont want to lose quality by re-encoding (and waste time), I am trying to do a direct stream copy. The problem is that I cannot select arbitrary frames for the chunks; only keyframes as the begnning of the segments. To circumvent this restriction I am trying to re-encode just the smallest portions between keyframes and patching up everything together.
This image should give you a better idea on what I am doing:
But what happens is that the direct stream copied chunks and the re-encoded chunks are incompatible even though they have the same codec, same FPS and same resolution. I can join them in the same file, but the video will either crash or the image will be messed up after "transitioning" between the two.
I used MKVInfo and I found out that everything is the same, except the CodecPrivate thing. I presume that the best I can try to do is to re-encode the smaller chunks with the same settings as the original ones so their CodecPrivate info will be the same. Is there any program I could use to determine these settings (eg. parse CodecPrivate)?
Thank you.
+ Reply to Thread
Results 1 to 5 of 5
-
-
Originally Posted by poisondeathray
Did you try doing it all at once in avidemux? What I mean is instead of cutting pieces then appending them, just cut the unwanted pieces out then save all in 1 go? -
Theoretically it's possible, just like in vdub with avi's, but I just tried on a sample clip and it was "jerky" between cuts.
Here are the archive builds for the cli version
http://techouse.project357.com/archive.html
Curious to see if it work out, please report back -
OK folks, after a lot of headache and trial and error, I finally did it.
Basically, what I did for the parts that needed re-encoding (see 1st post) was :
1. Extracted them to AVI as raw (YV12 and PCM - it won't work otherwise) using AVIDemux.
2. Re-encoded them using the exact same settings the original file used. Thanks to avinaptics it was possible to see what they were. To be on the safe side, I even used exactly the same x264 build that was used for the original video.
3. Because of some weird bug with AviDemux that won't let me open the .mkv files made by x264 (maybe because it's an old version) I had also to use mkvtools to demux and mux the video track again.
After all this work, I was finally able to join the segments smoothly with avidemux.
I even made a .bat file to automate part of the process:
Code:@ECHO OFF IF [%1] ==[] GOTO Syntax IF [%2] ==[] GOTO Syntax x264 --progress --bitrate 900 [whatever options] -o temp.mkv %1 640x480 mkvextract tracks temp.mkv 1:track.264 mkvmerge -o %2 --default-duration 0:23.976fps track.264 del track.264 del temp.mkv del 264.stats GOTO End :Syntax ECHO. ECHO Usage: enc264 infile outfile (resolution=640x480) ECHO. :End
Thank you all for your help.
Similar Threads
-
What form of h264 will VideoRedo h264 tvsuite accept?
By Asterra in forum Video ConversionReplies: 4Last Post: 12th Apr 2012, 13:22 -
Problems converting some xvid to h264 to append to another h264
By PlanetIndigo in forum Video ConversionReplies: 3Last Post: 6th Jun 2011, 14:13 -
H264/AC3 (MKV) to H264/AAC (MP4) ?
By jccca in forum Video ConversionReplies: 10Last Post: 13th Dec 2008, 19:06 -
H264: Are there other h264 (AVCHD/VC-1) encoding command-line/CLI tools ??
By vhelp in forum Newbie / General discussionsReplies: 12Last Post: 16th Feb 2008, 01:20 -
"chunks" cannot get my .VOB file to split into .DV chunks
By system9 in forum ffmpegX general discussionReplies: 2Last Post: 12th May 2007, 17:53