FORUMS: list search recent posts

extract stream of images from video file using ffmpeg

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrew Simpson
extract stream of images from video file using ffmpeg
on Nov 25, 2013 at 4:05:00 pm

I want to extract images from a ogg file using ffmpeg.

At the moment I am extracting them straight to the hard drive using these arguments:

-i - -qscale 1 h:\out\img-%05d.jpg
But i would like to extract directly to a stream.

What would be the arguments to use please?

thanks


Return to posts index

Lou Logan
Re: extract stream of images from video file using ffmpeg
on Nov 25, 2013 at 8:18:00 pm

[Andrew Simpson] "-i - -qscale 1 h:outimg-%05d.jpg"

Please show your actual ffmpeg command and the complete ffmpeg console output.

[Andrew Simpson] "But i would like to extract directly to a stream.

What would be the arguments to use please?"


What kind of stream? "stream" is somewhat an ambiguous term.


Return to posts index

Andrew Simpson
Re: extract stream of images from video file using ffmpeg
on Nov 26, 2013 at 6:44:17 pm

Hi,

Thank you so much for taking your time to reply to me.

I am afraid I am not explaining myself properly. My knowledge is limited to C#.

I can create a Process within my C# Winform App.

I have this 1st) process:

-f mjpeg -r 30 -i pipe:0 -c:v libtheora -q:v 7 -r 30 -f ogg pipe:1

I supply a byte array for pipe:0 from images (1 after another) until there are no more.

The pipe:1 gives me an output byte array that if I choose to write to a binary file would give me an OGG formatted file which I have tested and played with VLC.

I want to know if I could reverse this procedure. namely, extracting the original jpegs fron this OGG which is still within my running app as a byte array.

These arguments will work but the stdput are jpegs written to my hard drive:

-i pipe:0 -qscale 1 h:\out\img-%05d.jpg

What I am after is to replace 'h:\out\img-%05d.jpg' with something like:

{jpeg format} pipe:1

If I knew if this was possible and was given the correct arguments then I would be able to capture the byte array back in jepg formats (where I would use the hex values of the header of a jpeg to delineate the individual 'frames') .

I do not even know if it is possible and I cannot find anything related to this scenario by searching the Web.

The only output I have got from several guess is 'pipe closed'.

A typical guess would be:

-i pipe:0 -qscale 1 -f mjpeg pipe:1

Thanks for your time


Return to posts index


Lou Logan
Re: extract stream of images from video file using ffmpeg
on Nov 26, 2013 at 7:55:59 pm

I don't quite follow you, but basically you want the output to be piped?

[Andrew Simpson] "
A typical guess would be:

-i pipe:0 -qscale 1 -f mjpeg pipe:1"


Did this not do what you want?

If your input is already jpg you can stream copy with "-codec:v copy" instead of re-encoding.

Also see the documentation on the pipe protocol.

Note that going from whatever your input is (more guesswork here: one reason why the console output is always needed) to Theora, then to jpg will not provide the exact same frames.


Return to posts index

Andrew Simpson
Re: extract stream of images from video file using ffmpeg
on Nov 26, 2013 at 8:01:30 pm

Hi,

Thanks again for your time. The reason I want to encode these images into OGG video format is because I will save on the usage of my bandwidth when I send to my web server. On my web server I would want to extract the jpes. It is kind of like zipping an array of images for TCP transportation.

will -codec:v copy do that?

Thanks


Return to posts index

Lou Logan
Re: extract stream of images from video file using ffmpeg
on Nov 26, 2013 at 8:25:39 pm

Will "-codec:v" re-encode? No. Please read the documentation on stream copy mode.

You will experience quality loss going from your (unknown) input format to Theora and then to jpg (although you may not notice).


Return to posts index


Andrew Simpson
Re: extract stream of images from video file using ffmpeg
on Nov 27, 2013 at 7:06:19 am

Hi,

so this is not the solution then? Totally confused. I still do not know if it can be done or not :)

Thanks for your time...


Return to posts index

Lou Logan
Re: extract stream of images from video file using ffmpeg
on Nov 27, 2013 at 7:01:22 pm

[Andrew Simpson] "so this is not the solution then? Totally confused. I still do not know if it can be done or not :)"

It's up to you if it is the solution or not. Have you tried it?

It depends on your requirements and what you're trying to achieve. You wanted to output jpeg as an output pipe. I gave some info on that. Does it work for you and fit your needs?

You wanted to extract the "original jpeg" images from the OGG file, but Theora video is lossy and is a completely different format meaning going from your mystery input (jpg?) -> Theora -> to jpg will not result in the "original jpeg" images. However, using the right options may provide a sufficient enough quality. Is this acceptable?

As I have no information about your inputs, your ffmpeg version, and your ffmpeg configuration I can only offer limited suggestions (again, the actual ffmpeg commands and console ffmpeg console outputs would be extremely useful and should be considered to be required information).


Return to posts index

Andrew Simpson
Re: extract stream of images from video file using ffmpeg
on Nov 28, 2013 at 8:20:14 am

Hi,

The trouble with using Win C# is that i cannot give you the console output as I am using managed code. There is an event that I can debug but only If I do not redirect the StdOut. As I am trying to redirect the stdOut the act of testing the console output ruins the thing i am trying to do. Hence, there is no console output I can give you apart from the StdError which is 'pipe has ended'.

This is not Unix/Linux i am using C# and I am trying to interface with ffmpeg.exe. When I posted this question On StackOverFlow they said there was nothing wrong with my code it is down to the arguments being used with FFMPEG. They suggested posting on a FFMPEG discussion board. They also said no one has managed to do this.

Now, when I use a 3rd party component I look at the documentation 1st. There is nothing that gives me what I want. It is all to do with outputting to the hard drive.

The version of ffmpeg is the latest available on the Winform static builds. It would be the 1st thing I would have done was to download the latest.

I did try your suggestion but it did not work. In fact I think I had tried it before.

But thanks..


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]