[Libav-user] Slow down video

bsenftner at earthlink.net bsenftner at earthlink.net
Sat Oct 15 19:05:45 EEST 2022


My playback library removes/ignores audio and timing information, reducing overhead for minimal processing, as the use case is for algorithm training and video security, both process heavy use cases. i.e it tries to playback the video as fast as possible with as little CPU as it can. 

 

From: Libav-user <libav-user-bounces at ffmpeg.org> On Behalf Of Sushma
Sent: Saturday, October 15, 2022 9:07 AM
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user at ffmpeg.org>
Subject: Re: [Libav-user] Slow down video

 

Thanks for the reference code. I would like to check it.

 

Can you let me know what was the command line you had used to get it working. I was able to get blur video from the same command line in code as well. But not for slow down video. I was not able to slow down the complete video as well.

 

 

On Sat, Oct 15, 2022 at 8:06 PM <bsenftner at earthlink.net <mailto:bsenftner at earthlink.net> > wrote:

I have an ffmpeg video player that has the same AVFilter Graph text string inputs as the command line ffmpeg. You could try looking at how I setup the code and compare with what you’re doing.

 

The key bits are in this file:

https://github.com/bsenftner/ffvideo/blob/master/ffvideolib_src/ffvideo_frameMgr.h

 

There’s a frame manager class implementing frame filters starting around line 110. 

 

Note, this does not do audio, but I’ve been told by a dev with a similar playback library the audio handling is very similar. 

 

From: Libav-user <libav-user-bounces at ffmpeg.org <mailto:libav-user-bounces at ffmpeg.org> > On Behalf Of Sushma
Sent: Saturday, October 15, 2022 7:36 AM
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user at ffmpeg.org <mailto:libav-user at ffmpeg.org> >
Subject: Re: [Libav-user] Slow down video

 

Thanks for the reply.

 

If pix_fmt=0 does not work, what are the other pixel formats that I can use to achieve my requirement?

 

>>atrim gets from [in1], i.e. buffer, while in the other version atrim is
connected to [0:a], i.e. a abuffer.

 

Do you think I need to use it in a similar way in the API as well? If possible, can you share a sample filter string that I could use? I tried all possible ways but with no luck.

 

Regards,

Madhukar 

 

On Fri, Oct 14, 2022 at 6:43 PM Nicolas George <george at nsup.org <mailto:george at nsup.org> > wrote:

Sushma (12022-10-14):
> Hello All,
> 
> I'm trying to use FFMPEG to slow down part of video and audio using C++
> FFMPEG API. I was able to achieve it from the command line but however,
> argument parsing fails using api.
> 
> Here is the command line input
> 
> ffmpeg -i "inputvideo.mp4" -filter_complex
> "[0:v]trim=0:2,setpts=PTS-STARTPTS[v1];[0:v]trim=2:10,setpts=2*(PTS-STARTPTS)[v2];[0:v]trim=10,setpts=PTS-STARTPTS[v3];[0:a]atrim=0:2,asetpts=PTS-STARTPTS[a1];[0:a]atrim=2:10,asetpts=PTS-STARTPTS,atempo=0.5[a2];[0:a]atrim=10,asetpts=PTS-STARTPTS[a3];[v1][a1][v2][a2][v3][a3]concat=n=3:v=1:a=1"
> -preset superfast -profile:v baseline output.mp4
> 
> Here is the filter string i used in avfilter_graph_parse()
> 
> buffer=video_size=1920x1080:pix_fmt=0:time_base=1/30:pixel_aspect=0/1:frame_rate=30/1
> [in_1]; [in_1] trim = 0:2, setpts = PTS - STARTPTS [in_2]; [in_2] trim =
> 2:10, setpts = 2 * (PTS - STARTPTS)[in_3]; [in_3] trim = 10, setpts = PTS -
> STARTPTS[in_4]; [in_1] atrim = 0:2, asetpts = PTS - STARTPTS[in_5]; [in_5]
> atrim = 2:10, asetpts = PTS - STARTPTS, atempo = 0.5[in_6]; [in_6] atrim =
> 10, asetpts = PTS - STARTPTS[in_7]; [in_1] [in_2] [in_5] [in_3] [in_6]
> [in_4] [in_7] concat = n = 3:v = 1 : a = 1 [result]; [result] buffersink
> 
> Can anyone let me know where I'm wrong? What changes do I need to make in
> the filter string? Kindly help

I see several issues:

pix_fmt=0 will probably not work.

atrim gets from [in1], i.e. buffer, while in the other version atrim is
connected to [0:a], i.e. a abuffer.

You have several pads that are connected multiple times.

Regards,

-- 
  Nicolas George
_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org> 
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-request at ffmpeg.org <mailto:libav-user-request at ffmpeg.org>  with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org> 
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-request at ffmpeg.org <mailto:libav-user-request at ffmpeg.org>  with subject "unsubscribe".

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20221015/859affa0/attachment.htm>


More information about the Libav-user mailing list