![]() I tested the code above by generating synthetic video files (generated in the commented part). V1 = main_('scale', size='hd720').filter('trim', duration=33.3) # Use trim filter for the video.Ī1 = main_('atrim', duration=33.3) # Use atrim filter for the audio. # Assuming frame rate is 30 fps, 33.3 seconds applies 1000 frames. # Build synthetic video files (with audio): You may use trim filter for the video, atrim filter for the audio, and cut both by duration: import ffmpeg Cannot create the link trim:0 -> concat:1 I get these errors: Media type mismatch between the 'Parsed_trim_2' filter output pad 0 (video) and the 'Parsed_concat_3' filter input pad 1 (audio) None a split filter is probably requiredĪnd if I try to do it here: v1 = main_("scale", size='hd720').trim(start_frame=0, end_frame=1000)Ī1 = main_(start_frame=0, end_frame=1000) with multiple outgoing edges with same upstream label ValueError: Encountered trim(end_frame=1000, start_frame=0) If I know the start time and end time, I want to save the new file as multiple shorter files based on input. Joined = ncat(v1, a1, v2, a2, v=1, a=1).nodeīut if I add the trimming here: main_video = ffmpeg.input('in.mp4').trim(start_frame=0, end_frame=1000) Is there an easy way to trim a video file in python. I can do that without the trimming part import ffmpeg ![]() ![]() I need a very simple thing: trim in.mp4 to an arbitrary lenght, and concat outro.mp4 after it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |