Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Apr 2010
Posts: 9
|
How to split x264 encoded video into segments?
Hi,
First off, this is my first post on the forums. So hello everyone. I have been a long time reader but until now I have always been able to find answers to my questions without needing to start a new thread. Here is my problem: I have unsuccessfully been trying to split some video files I encoded with x264 into individual segments. I want to end up with a video segment for each keyframe where each segment is independent of other segments. (I.e. if the video file has 300 keyframes in it I want 300 segments.) Since I have not been able to achieve this so I figured I would ask on the forum. The files are going to be distributed over the internet and splitting them up like this makes distribution easier for my project. Can anyone point me towards something that can help me with this? It doesn't necessarily have to be a splitting method. If it is possible to directly encode the segments split up already then I wouldn't be opposed to re-encoding them. I actually tried encoding the segments separately to begin with, but I kept getting overlap at the cuts. Thanks =) edit: The final video needs to be in an mp4 container, so it would be best if someone knows a tool that can do this with a mp4 container directly Last edited by Guest; 13th April 2010 at 03:33. Reason: rule 12 |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
You could try using mkvtoolnix. Load the file into mmg and set splitting to "1K" "after this size" in the "global" tab. I haven't actually tried this, but it just might work.
/edit: OK, made a short test and the GUI doesn't allow it. Set it to anything, copy the command line into cmd and edit it manually to 1K. Last edited by sneaker_ger; 12th April 2010 at 23:23. |
![]() |
![]() |
![]() |
#4 | Link | |
Registered User
Join Date: Apr 2010
Posts: 9
|
Quote:
|
|
![]() |
![]() |
![]() |
#5 | Link |
Registered User
Join Date: Apr 2010
Posts: 9
|
I have never used the mkv container before. I used the mkvtoolnix tool that you recommended and it splits great when you use a 1kb filesize. I cannot get ffmpeg to convert it back to a mp4 container.
ffmpeg -i "split.mkv" -vcodec copy -acodec copy split.mp4 gives me av_interleaved_write_frame(): Error while opening file Here is the ffmpeg -i output on the source mp4: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'orig.mp4': Duration: 00:04:51.43, start: 0.000000, bitrate: 791 kb/s Stream #0.0(und): Video: h264, yuv420p, 432x240, 29.97 tb(r) Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16 And here is the ffmpeg -i output on the split.mkv that I am trying to turn back into a mp4: Input #0, matroska, from 'split.mkv': Duration: 00:00:00.97, start: 0.000000, bitrate: N/A Stream #0.0: Video: h264, yuv420p, 432x240, 29.97 tb(r) Stream #0.1: Audio: aac, 48000 Hz, stereo, s16 The stream info seems to be the same so I don't see why the copy doesn't work. I need the final output files to be in the mp4 container with h.264 video so I can play them in the browser. Any tips? I wish mp4box would work with a small filesize like this, but it doesn't. It seems to mess up if the input filesize or duration to split on is less than the next keyframe and outputs a corrupt file. So if you set it to do the filesize of 1kb it just keeps putting out corrupted files. I stepped away from my computer and came back with 10000 corrupted clips to delete =(. |
![]() |
![]() |
![]() |
#6 | Link | |
Registered User
Join Date: Apr 2008
Posts: 1,181
|
Quote:
If you are not using windows, apply my patch in that post to ffmpeg's code and make your own build. |
|
![]() |
![]() |
![]() |
Tags |
"split on keyframe", h.264, split, splitting, x264 |
Thread Tools | Search this Thread |
Display Modes | |
|
|