On Wed, 4 Feb 2004, Dragon_at_work wrote:
> Running into a bit of a problem merging y4m files together.
>
> Here is my basic schema:
>
> lav2yuv +n file_1.avi | yuvfps -v 0 -r 25:1 | yuvscaler -v O -O SVCD >
> file_1.y4m
> lav2yuv +n file_2.avi | yuvfps -v 0 -r 25:1 | yuvscaler -v O -O SVCD >
> file_2.y4m
> * note the YUV4MPEG header bits of this file_2.y4m file were removed.
> lav2yuv +n file_3.avi | yuvfps -v 0 -r 25:1 | yuvscaler -v O -O SVCD >
> file_3.y4m
> * note the YUV4MPEG header bits of this file_3.y4m file were removed.
I see nothing in that proceedure that removes the YUV4MPEG2 header
bits. How are you doing that?
Create a simple shell script - I'll call it 'strip1.sh:
----------
#!/bin/sh
read junk
cat
exit 0
----------
make it executable and place it somewhere in $PATH or even in the
current directory.
Then something like:
lav2yuv +n file_2.avi | yuvfps -v 0 -r 25:1 | yuvscaler -v O -O SVCD | ./strip1.sh >
file_2.y4m
will indeed have the header bits removed correctly.
Oh, and it's probably not a good idea to do something like
cat *.y4m > sum.y4m
Why? Because the shell redirection ('> sum.y4m') is done FIRST and
thus the cat command above will evaluate to
cat file_1.y4m file_2.y4m file_3.y4m sum.y4m > sum.y4m
I suspect that is not the desired result ;)
Instead do something like this:
(lav2yuv file1 ...; \
lav2yuv file2 ... | skip1.sh; \
lav2yuv file3 ... | skip1.sh) > sum.y4m
NOTE: no need at ALL for the file_1.y4m, file_2.y4m intermediate files.
BUT - since you're inside a shell script why not use a shell function:
skip1()
{
read junk
cat
return 0
}
Then the above sequence turns into simply:
(lav2yuv file1 ...; \
lav2yuv file2 ... | skip1; \
lav2yuv file3 ... | skip1) > sum.y4m
That can be extended even further - why create a .y4m file at all when
the sequence can be piped directly into the mpeg encoder:
And the 'lav2yuv' commands can be arbitrarily complex - each segment
could be run thru it's own yuvdenoise, or any other filter than
emits a Y4M stream on stdout.
(lav2yuv file1 ...; \
lav2yuv file2 ... | skip1.sh; \
lav2yuv file3 ... | skip1.sh) | mpeg2enc ...
THAT's my approach - not creating the large intermediate files and
manually stripping off the header and cat'ing the files together :)
> I wonder if I need to also need to modify other parts of the y4m file....
You do need to leave the initial FRAME\n present after removing
the header - the FRAME\n is NOT part of the header and should not
be removed. At least that was the problem someone else had - they
were accidentally removing a little too much from the front of the
files.
Cheers,
Steven Schultz
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users