FFMPEG

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

FFMPEG

Postby AWPStar » May 09, 2015 5:23

Hello mates!

Did somebody wrote 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.
dafhi
Posts: 1343
Joined: Jun 04, 2005 9:51

Re: FFMPEG

Postby dafhi » May 09, 2015 5:44

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

Re: FFMPEG

Postby AWPStar » May 09, 2015 5:59

dafhi wrote:did u try Handbrake?

No. But it doesn't support high-quality codecs like dnxhd or Prores. libavcodes does.
AWPStar
Posts: 38
Joined: May 03, 2009 21:47

Re: FFMPEG

Postby AWPStar » May 09, 2015 6:18

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

Re: FFMPEG

Postby grindstone » May 09, 2015 10:27

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: 38
Joined: May 03, 2009 21:47

Re: FFMPEG

Postby AWPStar » May 11, 2015 15:22

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: 721
Joined: May 05, 2015 5:35
Location: Germany

Re: FFMPEG

Postby grindstone » May 12, 2015 9:55

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: 721
Joined: May 05, 2015 5:35
Location: Germany

Re: FFMPEG

Postby grindstone » May 12, 2015 13:19

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

Return to “General”

Who is online

Users browsing this forum: No registered users and 4 guests