Log in

View Full Version : Concatenating 2 files with diffrent encoder setting (x264)


ben45
8th October 2016, 15:29
Hello
As you know matching x264's encoder settings isn't easy. Is there any way to concatenate mkv files with different encoder setting?
I have splitted 1.mkv to four parts and want to re-encode one part and append to other parts.

StainlessS
8th October 2016, 19:36
Perhaps this might help some (I not that familiar with ffmpeg):- http://forum.doom9.org/showthread.php?t=170404&highlight=join+ffmpeg

I just did a forum search for posts on "join ffmpeg"

or this:- http://forum.doom9.org/showthread.php?p=1654756&highlight=join+ffmpeg#post1654756

good luck

ben45
8th October 2016, 21:10
Perhaps this might help some (I not that familiar with ffmpeg):- http://forum.doom9.org/showthread.php?t=170404&highlight=join+ffmpeg

I just did a forum search for posts on "join ffmpeg"

or this:- http://forum.doom9.org/showthread.php?p=1654756&highlight=join+ffmpeg#post1654756

good luck

How can i extract h264 from mkv and split it?

StainlessS
8th October 2016, 21:21
I think maybe AviDemux should do that. (supports more than avi)

Jamaika
8th October 2016, 21:31
mkvmerge.exe --output 111.mkv --language 0:und ( 111.h264 112.h264 )

ben45
10th October 2016, 16:24
I did it! clip appended without any error or warning but there's problems on some TV players. Here's the steps
1. muxed .mkv file to mp4
2.demuxed and splited h264 stream from mp4 file with ffmpeg (http://www.videohelp.com/software/ffmpeg). Here's the script that i used
for %%a in ("*.mp4") do "C:\ffmpeg\bin\ffmpeg.exe" -i "%%a" -segment_times 240,480,720,10800 -vcodec copy -bsf h264_mp4toannexb -f segment -an "test-%%05d.h264"
pause

3. encoded part 2 with new setting
4. Joined h264 streams with DOS copy command
copy /b 1.h264 + 2.h264 + 3.h264 + 4.h264 output.h264

5.Muxed all h264 streams with mkvmerge (http://www.videohelp.com/software/MKVtoolnix) to .mkv

But there's a problem on playback! screen freezes for a while ( about 0.5 s ) on encoded part ( tested on Sumsung HDTV )
I have checked necessary settings like SAR and FPS and matched them but problem not solved

sorry for my bad english

Blue_MiSfit
11th October 2016, 06:05
Tried MPEG-TS instead?

ben45
11th October 2016, 08:00
Tried MPEG-TS instead?

No. I need .mkv output

raffriff42
11th October 2016, 13:53
Glad you took my suggestion (http://forum.videohelp.com/threads/380794-How-to-split-multiple-parts-with-ffmpeg?p=2462195#post2462195) to use -f segment.

To rejoin the segments, use ffmpeg again:
https://trac.ffmpeg.org/wiki/Concatenate
https://ffmpeg.org/ffmpeg-all.html#concat-1
https://ffmpeg.org/ffmpeg-all.html#concat-2

-f segment (https://ffmpeg.org/ffmpeg-all.html#segment_002c-stream_005fsegment_002c-ssegment) will even generate a segment list for you: -segment_list_type "ffconcat"

(EDIT no guarantee it will work with different encoder settings)