FFMPEG

General FreeBASIC programming questions.
Post Reply
AWPStar
Posts: 47
Joined: May 03, 2009 21:47

FFMPEG

Post by AWPStar »

Hello mates!

Did somebody write ffmpeg/libavcodec wrapper? Is it exist?

i need to conver 16bit raw video to dnxhd or Prores frame by frame. "ffmpeg.exe" allows me to do it with command line. but i can't controll process.
Last edited by AWPStar on Jan 26, 2023 11:24, edited 1 time in total.
dafhi
Posts: 1641
Joined: Jun 04, 2005 9:51

Re: FFMPEG

Post by dafhi »

did u try Handbrake?
AWPStar
Posts: 47
Joined: May 03, 2009 21:47

Re: FFMPEG

Post by AWPStar »

dafhi wrote:did u try Handbrake?
No. But it doesn't support high-quality codecs like dnxhd or Prores. libavcodes does.
AWPStar
Posts: 47
Joined: May 03, 2009 21:47

Re: FFMPEG

Post by AWPStar »

It seems that there is support for FFmpeg encoding in real-time by using pipes.
http://blog.mmacklin.com/2013/06/11/rea ... th-ffmpeg/
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: FFMPEG

Post by grindstone »

Hello AWPStar

Thank you for that hint. I'm looking for such an option since a long time. It has to be adapted to FB, but in principle it seems to work.

Greetings
grindstone
AWPStar
Posts: 47
Joined: May 03, 2009 21:47

Re: FFMPEG

Post by AWPStar »

grindstone

It looks like, and it works. But still there's some errors with buffer coming.


Code: Select all

Dim bt() As UByte

ReDim bt(320& * 240 * 4)

Dim As Long n, k

Open pipe "ffmpeg -f rawvideo -pix_fmt rgb0 -s 320x240 -r 24.000 -i - -an -f avi -vf vflip -vcodec:v libx264 -pix_fmt yuv420p -profile:v high -level:v 5.2 -q:v 0 -r 24.000 G:\ffmpeg\bin\test.avi" For Binary As #1
    
    For k = 0 To 47
        For n = 0 To 307200 - 1
            bt(n) = Int( Rnd * 256)
        Next
        
        Put #1, , bt()
    Next
    
Close #1

Sleep
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: FFMPEG

Post by grindstone »

Hello AWPStar,

AFAIK you have to state either "Read" or "Write" if you open a pipe as "Binary", because FB doesn't support bidirectional pipes yet.

Greetings
grindstone
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: FFMPEG

Post by grindstone »

I've tested your code, and it works fine. The buffer size error occurs when closing the pipe. It's only a disfigurement and doesn't affect the function of the program.

Greetings
grindstone
Post Reply