kinokikid
Posts: 10
Joined: Sat Nov 09, 2013 2:01 am

Q: How to split a h.264 video file on the pi?

Mon Nov 11, 2013 1:46 pm

Hello,

I need to split a h.264 video on the pi to convert it afterwards to mp4, because the videofilesize exceeds half of the capacity of the flashdrive. So I cannot convert it till I cut off something from the h.264 video file.

I know there is a command for MP4Box, but it is only working for mp4-files as far as I know. Can't find anything on the forum here either. I convert with avconv on Raspbian.

with best thanks for your help,
kinokikid
Last edited by kinokikid on Mon Nov 11, 2013 10:27 pm, edited 1 time in total.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: How to split a h.264 video file on the pi?

Mon Nov 11, 2013 2:13 pm

Ffmpeg has cutting capabilities just use the -ss parameter (seek start) and -t for clip duration
i.e. ffmpeg -i input.mp4 -acodec copy -vcodec copy -ss 00:30:00.000 -t 00:30:00.000 output.mp4 (retain a/v codec data "copy", start at 30 mins duration 30 mins, save result to output.mp4).
Cutting happens at the first Intra / key frame from the position set by "-ss" therefore actual start position saved may not be where you expect it to be.

Richard S.

kinokikid
Posts: 10
Joined: Sat Nov 09, 2013 2:01 am

Re: How to split a h.264 video file on the pi?

Mon Nov 11, 2013 2:56 pm

Merci Richard!
Thank you for your fast response. I will try it out.

greetings,
kinokikid/michael

kinokikid
Posts: 10
Joined: Sat Nov 09, 2013 2:01 am

Re: How to split a h.264 video file on the pi?

Mon Nov 11, 2013 9:53 pm

Ok,

it is not working. First it says that ffmpeg is outdated and I should use avconv. Then it starts but it shows an error and works just for a while until it stops completly.

Thats what it says:
[buffer @ 0x1b3e560] Buffering serveral frames is not supported. Please consume all available frames before adding a new one

Also I had problems to find out how long the video file ist. I used mediainfo on the pi but could it be that the video.h246 doesn't stores infos like the duration of the video and stuff? On my win7 in vlc it also doesn't show any duration and all the mp4 files are not even accepted by vlc and it crashes my premiere.

So I just went to the edit room of my university to check out the mp4 files on the computers there with premiere pro and final cut. But same problems there. All the files neither .h264 nor mp4 are accepted by those programs cs4 and final cut7. I really hoped it would work with the mp4 wrapped around the h264. Maybe the codecs are missing. Guess I will try this out tomorrow and let you know.

greetings,
kinokikid

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25462
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to split a h.264 video file on the pi?

Mon Nov 11, 2013 10:08 pm

Just a quick question - would a feature on the raspivid app that continually produced clips of a specified length (time or size) then moved to the next filename be useful to anyone? Sort of like timelapse for video - so you end up with x number of y length clips giving a total record length of x*y.

Was wondering if that would be useful.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

kinokikid
Posts: 10
Joined: Sat Nov 09, 2013 2:01 am

Re: How to split a h.264 video file on the pi?

Mon Nov 11, 2013 10:21 pm

jamesh wrote:Just a quick question - would a feature on the raspivid app that continually produced clips of a specified length (time or size) then moved to the next filename be useful to anyone? Sort of like timelapse for video - so you end up with x number of y length clips giving a total record length of x*y.

Was wondering if that would be useful.
Hej Jamesh,

I guess it could be very usefull actually. I cannot speak for everyone but for me as an art student it sounds quite useful. We are working on the topic of surveillance, society and its aesthetics and we wanted to build up little mobile timelapse devices. That is why we bought us the raspberry pi.

greetings,
kinokikid/michael

JustThisGuy
Posts: 114
Joined: Thu Jan 05, 2012 11:22 pm

Re: Q: How to split a h.264 video file on the pi?

Tue Nov 12, 2013 1:14 am

James,
Would the clips be continuous with no frame drops between clips? If so I could see making extremely large videos by chunking and sending them off the Pi in the background.

But even with a few seconds of drop this would be a very useful feature.
Any conversation about a sufficiently complex subject is indistinguishable from babble.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25462
Joined: Sat Jul 30, 2011 7:41 pm

Re: Q: How to split a h.264 video file on the pi?

Tue Nov 12, 2013 8:42 am

JustThisGuy wrote:James,
Would the clips be continuous with no frame drops between clips? If so I could see making extremely large videos by chunking and sending them off the Pi in the background.

But even with a few seconds of drop this would be a very useful feature.
I'd hope they would be pretty much continuous. Might drop a frame every now and then, but tbh, I won't know until I try it.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

kinokikid
Posts: 10
Joined: Sat Nov 09, 2013 2:01 am

Re: Q: How to split a h.264 video file on the pi?

Tue Nov 12, 2013 8:03 pm

Yeah, that would be really great!

Actually we wanted to buld a device that makes permanent hd-filming possible for our art project. But the size of files ist kind of a big problem we are struggeling with at the moment.

To come back to the topic. Is there any other split command. I'm still searching and looking for it. Perhaps someone can help me out here. Thank you.

Does avconv have one maybe? There are quite many commands for this programm but I cant find one in the help that clearly is a command to split the videofile.


Greetings,
kinokikid/michael

tvjon
Posts: 752
Joined: Mon Jan 07, 2013 9:11 am

Re: How to split a h.264 video file on the pi?

Tue Nov 12, 2013 9:20 pm

jamesh wrote:...would a feature on the raspivid app that continually produced clips of a specified length (time or size) then moved to the next filename be useful to anyone? ...
Yes please, very useful :)

Return to “Graphics, sound and multimedia”