replace several lines by one using the filter_complex

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

replace several lines by one using the filter_complex

FFmpeg-users mailing list
Hello,

I have a video that I need to extract two parts of it and merge together those parts. I can accomplish this using the TRIM/ATRIM filter together with the concat demuxer:


$ ffmpeg -i video.mp4 -vf "trim=start=7:end=1173,setpts=PTS-STARTPTS" -af "atrim=start=7:end=1173,asetpts=PTS-STARTPTS" part1.mp4


$ ffmpeg -i video.mp4 -vf "trim=start=1260:end=1430,setpts=PTS-STARTPTS" -af "atrim=start=1260:end=1430,asetpts=PTS-STARTPTS" part2.mp4


After this I create a file input.txt (duration found with ffprobe):
file 'part1.mp4'
duration 1166.02file 'part2.mp4'duration 170.02


And finish with


$ ffmpeg -f concat -i input.txt -c copy video_final.mp4


This sequence of steps work as expected but I would like to know if it is possible to use the filter_complex with only "one line command" to achieve same result ?

Kind regards,
Leonardo
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: replace several lines by one using the filter_complex

Gyan Doshi-2


On 10-07-2020 01:01 am, Leonardo via ffmpeg-user wrote:

> $ ffmpeg -i video.mp4 -vf "trim=start=7:end=1173,setpts=PTS-STARTPTS" -af "atrim=start=7:end=1173,asetpts=PTS-STARTPTS" part1.mp4
>
>
> $ ffmpeg -i video.mp4 -vf "trim=start=1260:end=1430,setpts=PTS-STARTPTS" -af "atrim=start=1260:end=1430,asetpts=PTS-STARTPTS" part2.mp4
>
>
> After this I create a file input.txt (duration found with ffprobe):
> file 'part1.mp4'
> duration 1166.02file 'part2.mp4'duration 170.02
>
>
> And finish with
>
>
> $ ffmpeg -f concat -i input.txt -c copy video_final.mp4
>
>
> This sequence of steps work as expected but I would like to know if it is possible to use the filter_complex with only "one line command" to achieve same result ?

Yes, using the concat filter.

     ffmpeg -i video.mp4 -filter_complex "[0:v]trim=start=7:end=1173,setpts=PTS-STARTPTS[v1];[0:v]trim=start=1260:end=1430,setpts=PTS-STARTPTS[v2];[0:a]atrim=start=7:end=1173,asetpts=PTS-STARTPTS[a1];[0:a]atrim=start=1260:end=1430,asetpts=PTS-STARTPTS[a2];[v1][a1][v2][a2]concat=n=2:v=1:a=1" merged.mp4

Gyan

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: replace several lines by one using the filter_complex

FFmpeg-users mailing list
 

    On Friday, July 10, 2020, 1:37:39 AM GMT-3, Gyan Doshi <[hidden email]> wrote:  


Yes, using the concat filter.

    ffmpeg -i video.mp4 -filter_complex "[0:v]trim=start=7:end=1173,setpts=PTS-STARTPTS[v1];[0:v]trim=start=1260:end=1430,setpts=PTS-STARTPTS[v2];[0:a]atrim=start=7:end=1173,asetpts=PTS-STARTPTS[a1];[0:a]atrim=start=1260:end=1430,asetpts=PTS-STARTPTS[a2];[v1][a1][v2][a2]concat=n=2:v=1:a=1" merged.mp4

Gyan


Thank you Gyan !!
Kind regards,Leonardo

 
 
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: replace several lines by one using the filter_complex

andrei ka
guess it'll make jumps in pts, maybe genps on output would be useful

On Fri, Jul 10, 2020 at 1:46 PM Leonardo via ffmpeg-user <
[hidden email]> wrote:

>
>
>     On Friday, July 10, 2020, 1:37:39 AM GMT-3, Gyan Doshi <
> [hidden email]> wrote:
>
>
> Yes, using the concat filter.
>
>     ffmpeg -i video.mp4 -filter_complex
> "[0:v]trim=start=7:end=1173,setpts=PTS-STARTPTS[v1];[0:v]trim=start=1260:end=1430,setpts=PTS-STARTPTS[v2];[0:a]atrim=start=7:end=1173,asetpts=PTS-STARTPTS[a1];[0:a]atrim=start=1260:end=1430,asetpts=PTS-STARTPTS[a2];[v1][a1][v2][a2]concat=n=2:v=1:a=1"
> merged.mp4
>
> Gyan
>
>
> Thank you Gyan !!
> Kind regards,Leonardo
>
>
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".