Split video file

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Split video file

Adrian Boeing
Hi,

I am trying to split a video file into multiple smaller sections.

If I try it directly via:
ffmpeg -ss 00:00:30 -t 00:00:30 -i INPUT -vcodec copy -acodec copy
sub_video1.mpg
then this just copies the audio stream.

I read somewhere that you need to convert your video to "intra" frames
first.
ffmpeg -i INPUT -sameq -intra video_intra.mpg

This then works when splitting:
ffmpeg -ss 00:00:30 -vsync 0 -t 00:00:30 -i video_intra.mpg -vcodec copy
-acodec copy sub_video1.mpg
ffmpeg -ss 00:01:00 -vsync 0 -t 00:00:30 -i video_intra.mpg -vcodec copy
-acodec copy sub_video2.mpg

However the output video looks terrible (very low resolution, and very
jerky).
Is there some better way to do this?

Ideally, being able to just cut a section from the input video that
'snaps' to the keyframes so I can split it into multiple smaller videos
without having to do a complete rencode.

Thanks,
-Adrian

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Split video file

Thomas Rehaag


Adrian Boeing schrieb:
>
> Hi,
>
> I am trying to split a video file into multiple smaller sections.
>
> If I try it directly via:
> ffmpeg -ss 00:00:30 -t 00:00:30 -i INPUT -vcodec copy -acodec copy
> sub_video1.mpg
> then this just copies the audio stream.

Hi,

I've tried your command line and it works perfectly in my case.
What about trying an other input file?

Regards,

Thomas
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Split video file

Adrian Boeing
Hi Thomas,

> Adrian Boeing schrieb:
>  
>> Hi,
>>
>> I am trying to split a video file into multiple smaller sections.
>>
>> If I try it directly via:
>> ffmpeg -ss 00:00:30 -t 00:00:30 -i INPUT -vcodec copy -acodec copy
>> sub_video1.mpg
>> then this just copies the audio stream.
>>    
>
> Hi,
>
> I've tried your command line and it works perfectly in my case.
> What about trying an other input file?
>  
Thanks for your reply, you are in fact correct, I tried some other files
and it worked - but not perfectly : both videos contain 'overlap' of the
same content.

I assume this happens because of copying the stream directly, including
the video between the keyframes. Effectively duplicating the video
between keyframes. (I'm not sure how to best explain this..)

What I think I need in order to solve this issue is to force the video
to split at a keyframe close to the time I specify, as opposed to
exactly at the time I specify - is there a way to do this?

Thanks,
-Adrian
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Split video file

Thomas Rehaag
Adrian Boeing schrieb:

>
> Hi Thomas,
>
> > Adrian Boeing schrieb:
> >
> >> Hi,
> >>
> >> I am trying to split a video file into multiple smaller sections.
> >>
> >> If I try it directly via:
> >> ffmpeg -ss 00:00:30 -t 00:00:30 -i INPUT -vcodec copy -acodec copy
> >> sub_video1.mpg
> >> then this just copies the audio stream.
> >>
> >
> > Hi,
> >
> > I've tried your command line and it works perfectly in my case.
> > What about trying an other input file?
> >
> Thanks for your reply, you are in fact correct, I tried some other files
> and it worked - but not perfectly : both videos contain 'overlap' of the
> same content.
>
> I assume this happens because of copying the stream directly, including
> the video between the keyframes. Effectively duplicating the video
> between keyframes. (I'm not sure how to best explain this..)
>
> What I think I need in order to solve this issue is to force the video
> to split at a keyframe close to the time I specify, as opposed to
> exactly at the time I specify - is there a way to do this?
>
> Thanks,
> -Adrian

Hi Adrian,

> and it worked - but not perfectly : both videos contain 'overlap' of the
> same content.

I don't quite get what you mean by "overlap of the same content".
 
> to split at a keyframe close to the time I specify, as opposed to

I allways thought, ffmpeg takes the nearest keyframe by itselfe.
I've never had this kind of picture salad from ffmpeg you'll get from a
system like windows media encoder, that doesn't care about key frames.

Cheers,

Thomas
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user