This forum has been archived. All content is frozen. Please use KDE Discuss instead.

editing short part of long video and rejoining using MP4Box (not working properly)

Tags: None
(comma "," separated)
mulberries
Registered Member
Posts
4
Karma
0
I'm trying to change a few parts of a large video without having to
render the whole file which would take up my pc for about a day.

I'm trying to do this by cutting the video into parts using, say (if
I wanted to cut off a clip lasting 11 minutes 20 s starting 30 s
into the original video)

ffmpeg -ss 00:00:30.0 -t 00:11:20.0 -i originalvideo.MP4 -acodec copy
-vcodec copy -async 1 part1.mp4

I'll then cut off the next (say 20 minute) section using

ffmpeg -ss 00:11:50.0 -t 00:30:00.0 -i originalvideo.MP4 -acodec copy
-vcodec copy -async 1 part2.mp4

If I want to edit, say, just part one I'd do that in kdenlive and
save the edited video as part1edited.mp4

I'd then join the two parts together using

MP4Box -cat part1edited.mp4 -cat part2.mp4 finalproduct.mp4

However when I view finalproduct.mp4 with vlc it opens two windows,
one of which is full screen with no frame or timeline slider
and seems play two versions of the video at the same time. The
video is very jerky and if I try to move to another part of the
video (on the window that has a timeline slider) it jams up
alltogether).

This is probably something to do with MP4Box not working properly
but if I just join the two original parts of the video back together
without first editing one of them in kdenlive (using MP4Box -cat
part1.mp4 -cat part2.mp4 finalproduct.mp4) the rejoined video plays
fine (part1edited.mp4 also plays fine).

(There is only one other apparent glitch in MP4Box in that if part
one is very short, (about 1 minute or less), part1 plays then
the last frame of part1 freezes for the same length of time as part1
lasts before moving on to part2)

(I'm running on Ubuntu 11.10 and had to install the extra repositories etc
to get kdenlive working.)

Thanks

Andrew





capslock
Registered Member
Posts
699
Karma
4
OS
Hi Andrew,

does part1edited.mp4 have exactly the same render settings as the original clips? Same frame rate, bitrate, colormodel, quality settings (I-Frames and stuff)? It seems, as if there might be your problem, if all clips play fine, when played alone.
mulberries
Registered Member
Posts
4
Karma
0
Thanks for your suggestion - I did try to get it all the same - same resolution, frame rate, codec, audio sample rate. The video sample rate is given as N/A in the nautilus file properties so I don't know how to set that. How can I find the bit rate and find and set the other settings you mention.

Is there any way of automatically setting the parameters of the output of kdenlive to be exactly the same as the parameters any given input clip?

To test if this is the probklem I tried joining the edited clip to itself using

MP4Box -cat part1edited.mp4 -cat part1edited.mp4 finalproduct2.mp4

and it worked slightly better but
i) it copied part1edited joined together three times rather than two (so for example joining two 10 minute clips would give a 30 minute video rather than 20 minute)
ii) When I watch the joined video on VLC, when it comes to the part that's joined, the last frame of the part before the join freezes rather than going on to the next part (although the time counter carries on increasing as usual). However if I then click back along the slider line to a point a few seconds after the join the first part of the next clip plays, as if it had joined correctly.

If I join two clips straight from a camera I don't seem to get these problems.

Thanks

Andrew
mulberries
Registered Member
Posts
4
Karma
0
Thanks for your suggestion - I did try to get it all the same - same resolution, frame rate, codec, audio sample rate. The video sample rate is given as N/A in the nautilus file properties so I don't know how to set that. How can I find the bit rate and find and set the other settings you mention.

Is there any way of automatically setting the parameters of the output of kdenlive to be exactly the same as the parameters any given input clip?

To test if this is the probklem I tried joining the edited clip to itself using

MP4Box -cat part1edited.mp4 -cat part1edited.mp4 finalproduct2.mp4

and it worked slightly better but
i) it copied part1edited joined together three times rather than two (so for example joining two 10 minute clips would give a 30 minute video rather than 20 minute)
ii) When I watch the joined video on VLC, when it comes to the part that's joined, the last frame of the part before the join freezes rather than going on to the next part (although the time counter carries on increasing as usual). However if I then click back along the slider line to a point a few seconds after the join the first part of the next clip plays, as if it had joined correctly.

If I join two clips straight from a camera I don't seem to get these problems.

Thanks

Andrew
mulberries
Registered Member
Posts
4
Karma
0
I think the main problem is differing parameters, probably bit rate,
in the edited and unedited clips I'm trying to join. As far as I
can see the actual audio and video bit rates of a rendered clip
don't come out the same as the bit rate's that I set in the kdenlive
render project box.

I've moved from MP4Box to mencoder
mencoder -oac pcm -ovc copy -idx -o joined.mp4 pt1.mp4 pt2.mp4
and this seems to give better
joins than MP4Box (ie without the frozen frames I mentioned before)
if the two clips have the same parameters.

The mencoder copy command also gives file informantion,
so

mencoder -oac pcm -ovc copy -idx -o outputfile.mp4 originalclip.mp4
gives (among other things)

VIDEO: [H264] 1440x1080 24bpp 29.970 fps 7993.0 kbps (975.7 kbyte/s)
[V] filefmt:44 fourcc:0x34363248 size:1440x1080 fps:29.970 ftime:=0.0334
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))


If I then render a clip, setting audio bitrate 7993.0 audio bitrate
128, its stats are:-

VIDEO: [H264] 1440x1080 24bpp 29.970 fps 8941.2 kbps (1091.5 kbyte/s)
[V] filefmt:44 fourcc:0x34363248 size:1440x1080 fps:29.970 ftime:=0.0334
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 39.9 kbit/2.60% (ratio: 4985->192000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))

ie, not the bit rates that I set, and it wont join onto the original clip.







Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kde-naveen, Sogou [Bot], Yahoo [Bot]