Hello all, sorry for the cross-posting,
Back to the old codec issue here. I was hapiliy working with photo-jpg compressed quicktime files for the last couple years. Now I'm working on an installation that I'm aiming to make using only open-source software.
My "orginal" footage is a sequence of 300,000 jpeg frames (80% quality) And all I need is a video file that matches the jpg quality of the frames, and most importantly is seekable and loadable in Gem.
So what I want to do is create a quicktime file, using photo-jpeg as the codec. Simple eh? hmmm.
My first try was:
ffmpeg -i %d.jpg -sameq -vcodec ljpeg output.mov
Which created the file fine (where, FYI, quicktime pro died miserably) but was very big (which is ok) but I could not get vlc,mplayer,totem to load it. ffmpeg printed something about "MS style codec tag" when creating the file. so I also tried:
ffmpeg -i %d.jpg -sameq -vcodec mjpeg output.mov
which did about the same thing, so I gave up on quicktime and tried a couple AVIs:
ffmpeg -i %d.jpg -sameq -vcodec mjpeg output.avi ffmpeg -i %d.jpg -sameq -vcodec ljpeg output.avi
A little better, many of my Gem decoders loaded the file, but not a single one was able to make it seekable, I tried all the decoders... all return -1 frames.
So right now I'm building a mpeg2 to try out, though I know decoding is going to be less efficient.
So my final questions are:
suited to build from jpg frames? What container?
land app?
Thank you!
Oh and Johannes, I do have the v4l_compat module loaded, so I don't know why xawtv reads my v4l2 video stream but Gem does not. Any ideas?
<B>
Le Lundi 29 Août 2005 11:23, B. Bogart a écrit :
- How can I create the [answer to #1] using ffmpeg
or some other linux land app?
Try with the mjpeg tools (http://mjpeg.sourceforge.net/), or transcode (http://www.transcoding.org/) or even mencode on OSX (http://mplayerosx.sourceforge.net/) -- Marc
B. Bogart wrote:
Hello all, sorry for the cross-posting,
So my final questions are:
- What codec should I use for 300,000 frames (14GB or so) and is well
suited to build from jpg frames? What container?
as marc has pointed out: mjpegtools
you can also use ppmtompeg (on debian this is part of netpbm) to create an mpeg out of a series of images (despite of the "ppm" in the name they can also be jpegs)
Oh and Johannes, I do have the v4l_compat module loaded, so I don't know why xawtv reads my v4l2 video stream but Gem does not. Any ideas?
so the current problem is freezing (not just being unable to connect to the driver) ? are you using pd's realtime flag ?
you could try running everything in gdb and then kill the process when it freezes and then get a backtrace to see where it was when it froze.
mfg.juz.ssd IOhannes
Thanks for the suggestions.
I'm not sure about using a mpeg for the following reasons:
#1. was does the interframe compression thing work, in other words how does it compare when seeking to a quicktime with photo-jpg codec?
#2. I'm damn confused about the seeking (see below)
So I have mpeg1 and mpeg3 on my machine,
% "open alea.mpg 4" gives me a seekable file. GEM: pix_film: Loaded file: /home/bbogart/pd-stuff/Gem/examples/data/alea.mpg with 31 frames (320x240) % file alea.mpg alea.mpg: MPEG sequence, v1, progressive Y'CbCr 4:2:0 video, 320x240, 4:3, 30 fps
% "open test.mpg 4" gives me a unseekable file. GEM: pix_film: Loaded file: /raid0/membrane/test.mpg with 0 frames (640x480) % file test.mpg test.mpg: MPEG sequence, v1, system multiplex
test.mpg was created with ffmpeg.
So if an mpeg performs as well as a quicktime with photo-jpeg than can someone give me an example of how to create an mov that will be seekable in Gem using mjpegtools or transcode? Since obviously its not difficult to make an unseekable one...
Aside: What id the different between mjpeg and photojpeg as a video codec? ffmpeg reports my sequence of jpegs as "mjpeg"...
Ok, I'm installing mjpegtools and netpbm.
B.
IOhannes m zmoelnig wrote:
B. Bogart wrote:
Hello all, sorry for the cross-posting,
So my final questions are:
- What codec should I use for 300,000 frames (14GB or so) and is well
suited to build from jpg frames? What container?
as marc has pointed out: mjpegtools
you can also use ppmtompeg (on debian this is part of netpbm) to create an mpeg out of a series of images (despite of the "ppm" in the name they can also be jpegs)
On Aug 30, 2005, at 10:05 PM, B. Bogart wrote:
Thanks for the suggestions.
I'm not sure about using a mpeg for the following reasons:
#1. was does the interframe compression thing work, in other words how does it compare when seeking to a quicktime with photo-jpg codec?
You want to avoid interframe compression at all costs. In order to
grab a random frame in an interframe codec the nearest previous
keyframe must be found and all interframes between it and the
requested frame are decoded. You could get lucky and hit a keyframe
or be very unlucky and hit the frame right before one.
Interframe compression techniques are used almost exclusively for
final content distribution (web, DVD, ATSC). Acquisition and
production codec never use this with the exception of HDV (which is
MPEG2).
Aside: What id the different between mjpeg and photojpeg as a video codec?
mjpeg is motion-jpeg which is for interlaced two field video. Each
field (50 or 60 per second) is a compressed with jpeg techniques.
ffmpeg reports my sequence of jpegs as "mjpeg"...
It is mistaken if your sequence is single progressive frames, which
it almost certainly is.
cgc
Hi all,
Thanks for the wealth of info.
I made a couple mpegs and TOCs and it works fine. I decided to create GOPs of only a single frame to force the lack of interframe compression.
So it *almost* works in Gem, almost eh...
Well I can seek only forwards, not backwards.
Lets call the current frame Fc and the previous frame Fp:
if Fp < Fc seeking works fine if Fp > Fc the mpeg immediatly jumps to the first frame and sticks on the first frame for as long as this condition is true.
Maybe I need a 2 frame GOP to get bidirectionality?
I've been unable to seek any mpeg at all without using the mpeg3toc thing, Including my single frame GOP, they just scrub forward as you twiddle the frame number.
We'll I'm close anyhow. off to look at lvs-studio...
Thanks again,
B.
chris clepper wrote:
On Aug 30, 2005, at 10:05 PM, B. Bogart wrote:
Thanks for the suggestions.
I'm not sure about using a mpeg for the following reasons:
#1. was does the interframe compression thing work, in other words how does it compare when seeking to a quicktime with photo-jpg codec?
You want to avoid interframe compression at all costs. In order to grab a random frame in an interframe codec the nearest previous keyframe must be found and all interframes between it and the requested frame are decoded. You could get lucky and hit a keyframe or be very unlucky and hit the frame right before one.
Interframe compression techniques are used almost exclusively for final content distribution (web, DVD, ATSC). Acquisition and production codec never use this with the exception of HDV (which is MPEG2).
Aside: What id the different between mjpeg and photojpeg as a video codec?
mjpeg is motion-jpeg which is for interlaced two field video. Each field (50 or 60 per second) is a compressed with jpeg techniques.
ffmpeg reports my sequence of jpegs as "mjpeg"...
It is mistaken if your sequence is single progressive frames, which it almost certainly is.
cgc
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Correction:
I just created a TOC from a mpeg2enc -f 1 file and I CAN seek backwards!
I was confused because a -f 0 mpeg (mpeg1) did not allow this, and "file" reports my -f 1 (mpeg2) stream as a v1 stream... blech.
Anyhow I need to tweak the quality a bit and we're in business.
For the archives this is the command I used to create the mpeg2 from frames using mjpegtools:
jpeg2yuv -f 25 -I p -v 0 -j ./test/link/%d.jpg | mpeg2enc -o test3.mpg -g 1 -G 1 -f 1 && mpeg3toc test3.mpg test3.toc
which looks pretty ugly for the record, even being 600MB (small)
Thanks all.
B>
B. Bogart wrote:
Hi all,
Thanks for the wealth of info.
I made a couple mpegs and TOCs and it works fine. I decided to create GOPs of only a single frame to force the lack of interframe compression.
So it *almost* works in Gem, almost eh...
Well I can seek only forwards, not backwards.
Lets call the current frame Fc and the previous frame Fp:
if Fp < Fc seeking works fine if Fp > Fc the mpeg immediatly jumps to the first frame and sticks on the first frame for as long as this condition is true.
Maybe I need a 2 frame GOP to get bidirectionality?
I've been unable to seek any mpeg at all without using the mpeg3toc thing, Including my single frame GOP, they just scrub forward as you twiddle the frame number.
We'll I'm close anyhow. off to look at lvs-studio...
Thanks again,
B.
chris clepper wrote:
On Aug 30, 2005, at 10:05 PM, B. Bogart wrote:
Thanks for the suggestions.
I'm not sure about using a mpeg for the following reasons:
#1. was does the interframe compression thing work, in other words how does it compare when seeking to a quicktime with photo-jpg codec?
You want to avoid interframe compression at all costs. In order to grab a random frame in an interframe codec the nearest previous keyframe must be found and all interframes between it and the requested frame are decoded. You could get lucky and hit a keyframe or be very unlucky and hit the frame right before one.
Interframe compression techniques are used almost exclusively for final content distribution (web, DVD, ATSC). Acquisition and production codec never use this with the exception of HDV (which is MPEG2).
Aside: What id the different between mjpeg and photojpeg as a video codec?
mjpeg is motion-jpeg which is for interlaced two field video. Each field (50 or 60 per second) is a compressed with jpeg techniques.
ffmpeg reports my sequence of jpegs as "mjpeg"...
It is mistaken if your sequence is single progressive frames, which it almost certainly is.
cgc
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Correction #2:
mpeg2enc -f 0 is mpeg1 mpeg2enc -f 1 is mpeg1 to VCD spec (huh?)
I'm trying -f 3 (mpeg2) now...
b.
B. Bogart wrote:
Correction:
I just created a TOC from a mpeg2enc -f 1 file and I CAN seek backwards!
I was confused because a -f 0 mpeg (mpeg1) did not allow this, and "file" reports my -f 1 (mpeg2) stream as a v1 stream... blech.
Anyhow I need to tweak the quality a bit and we're in business.
For the archives this is the command I used to create the mpeg2 from frames using mjpegtools:
jpeg2yuv -f 25 -I p -v 0 -j ./test/link/%d.jpg | mpeg2enc -o test3.mpg -g 1 -G 1 -f 1 && mpeg3toc test3.mpg test3.toc
which looks pretty ugly for the record, even being 600MB (small)
Thanks all.
B>
B. Bogart wrote:
Hi all,
Thanks for the wealth of info.
I made a couple mpegs and TOCs and it works fine. I decided to create GOPs of only a single frame to force the lack of interframe compression.
So it *almost* works in Gem, almost eh...
Well I can seek only forwards, not backwards.
Lets call the current frame Fc and the previous frame Fp:
if Fp < Fc seeking works fine if Fp > Fc the mpeg immediatly jumps to the first frame and sticks on the first frame for as long as this condition is true.
Maybe I need a 2 frame GOP to get bidirectionality?
I've been unable to seek any mpeg at all without using the mpeg3toc thing, Including my single frame GOP, they just scrub forward as you twiddle the frame number.
We'll I'm close anyhow. off to look at lvs-studio...
Thanks again,
B.
chris clepper wrote:
On Aug 30, 2005, at 10:05 PM, B. Bogart wrote:
Thanks for the suggestions.
I'm not sure about using a mpeg for the following reasons:
#1. was does the interframe compression thing work, in other words how does it compare when seeking to a quicktime with photo-jpg codec?
You want to avoid interframe compression at all costs. In order to grab a random frame in an interframe codec the nearest previous keyframe must be found and all interframes between it and the requested frame are decoded. You could get lucky and hit a keyframe or be very unlucky and hit the frame right before one.
Interframe compression techniques are used almost exclusively for final content distribution (web, DVD, ATSC). Acquisition and production codec never use this with the exception of HDV (which is MPEG2).
Aside: What id the different between mjpeg and photojpeg as a video codec?
mjpeg is motion-jpeg which is for interlaced two field video. Each field (50 or 60 per second) is a compressed with jpeg techniques.
ffmpeg reports my sequence of jpegs as "mjpeg"...
It is mistaken if your sequence is single progressive frames, which it almost certainly is.
cgc
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
hi all, i don't know if it's an useful reply, but this is what i'm using to convent a dv - avi (720x480) to a beautiful, deinterlace, 640x480, mpeg with keyframe everyframe:
ffmpeg -i stop.avi -vcodec mpeg2video -cropleft 40 -cropright 40 -sameq -deinterlace -intra -g 1 -an stop_final.mpeg
pat
B. Bogart wrote:
Thanks for the suggestions.
I'm not sure about using a mpeg for the following reasons:
#1. was does the interframe compression thing work, in other words how does it compare when seeking to a quicktime with photo-jpg codec?
#2. I'm damn confused about the seeking (see below)
as chris has pointed out, interframe compression can be a crux. however: solution a: make each frame a keyframe (should be possible with the encoder of your choice) solution b: don't care about keyframes at all, use an external tool to create a TOC of your mpeg, so that the decoder knows where to look for keyframes (mpeg3toc of the mpeg3-utils package) and load the toc-file into Gem and seek the file.
of course, solution b is more cpu and disk intensive, so you might still want to avoid it. it relies on libmpeg3 (imo libmpeg1 is unusable anyhow)
mfg.ads.r IOhannes
hello,
Am Mittwoch 31 August 2005 09:29 schrieb IOhannes m zmoelnig:
B. Bogart wrote:
Thanks for the suggestions.
I'm not sure about using a mpeg for the following reasons:
#1. was does the interframe compression thing work, in other words how does it compare when seeking to a quicktime with photo-jpg codec?
without buffering pre-calculated b-frames or p-frames, you can not seek to them, only to the i-frames which always contain a fully coded picture. the b and p frames only save the difference to that picture.....
#2. I'm damn confused about the seeking (see below)
as chris has pointed out, interframe compression can be a crux. however: solution a: make each frame a keyframe (should be possible with the encoder of your choice) solution b: don't care about keyframes at all, use an external tool to create a TOC of your mpeg, so that the decoder knows where to look for keyframes (mpeg3toc of the mpeg3-utils package) and load the toc-file into Gem and seek the file.
usually you dont need a toc to seek to the i frames. in an mpeg stream, a sequence is stored in a gop, a group of pictures. that one looks like: IBBPBBPBB and always repeats. inside the reader it should be possible to address the gop's directly, so that you can directly seek to the next / previous i-frame. b-frames are bi-directional encoded, meaning that you can seek to them as well, as long as you have the previous frames "at hand", but still they require some more decoding work than plain i-frames.
for example, there is a nice software tool to cut endcoded mpeg videos without recompressing them. of course, you can only cut at the boundaries of a gop, thus it is called gopchop: http://outflux.net/unix/software/GOPchop/ maybe that gives some ideas how a seek could be implemented....
of course, solution b is more cpu and disk intensive, so you might still want to avoid it. it relies on libmpeg3 (imo libmpeg1 is unusable anyhow)
mfg.ads.r IOhannes
greetings,
chris
A bit late (after all the nice answers) but I have encountered the same problem, the question of what codec to chose for linux compatibility, in my case where the mastering is done on a Mac. As I understand it a good choise is to use MJPEG(motion jpeg), and everything will be fine and compatible for linux. I haven't relly understood what photo-jpeg actully is(apple specific?) but both DV and MJPEG are cross platform and well defined. Using them is quite safe...
/my to cents...
mån 2005-08-29 klockan 11:23 -0400 skrev B. Bogart:
Hello all, sorry for the cross-posting,
Back to the old codec issue here. I was hapiliy working with photo-jpg compressed quicktime files for the last couple years. Now I'm working on an installation that I'm aiming to make using only open-source software.
My "orginal" footage is a sequence of 300,000 jpeg frames (80% quality) And all I need is a video file that matches the jpg quality of the frames, and most importantly is seekable and loadable in Gem.
So what I want to do is create a quicktime file, using photo-jpeg as the codec. Simple eh? hmmm.
My first try was:
ffmpeg -i %d.jpg -sameq -vcodec ljpeg output.mov
Which created the file fine (where, FYI, quicktime pro died miserably) but was very big (which is ok) but I could not get vlc,mplayer,totem to load it. ffmpeg printed something about "MS style codec tag" when creating the file. so I also tried:
ffmpeg -i %d.jpg -sameq -vcodec mjpeg output.mov
which did about the same thing, so I gave up on quicktime and tried a couple AVIs:
ffmpeg -i %d.jpg -sameq -vcodec mjpeg output.avi ffmpeg -i %d.jpg -sameq -vcodec ljpeg output.avi
A little better, many of my Gem decoders loaded the file, but not a single one was able to make it seekable, I tried all the decoders... all return -1 frames.
So right now I'm building a mpeg2 to try out, though I know decoding is going to be less efficient.
So my final questions are:
- What codec should I use for 300,000 frames (14GB or so) and is well
suited to build from jpg frames? What container?
- How can I create the [answer to #1] using ffmpeg or some other linux
land app?
Thank you!
Oh and Johannes, I do have the v4l_compat module loaded, so I don't know why xawtv reads my v4l2 video stream but Gem does not. Any ideas?
<B> _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list