You are not logged in.
Is there a procedure to perform an insert of jpeg images into an .avi movie (mpeg4 640x480 30fps)?
Last edited by lilsirecho (2007-08-08 01:23:09)
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
Do you want to insert images on either end of the movie or throughout the movie?
Offline
I would do either but would accept the beginning and end for starters....
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
There are different approaches you can take. If you're going to end up adding a bunch of frames throughout the movie, it may be best just to parse the movie. You can use FFMPEG or Mencoder to do this. For instance, the command in FFMPEG would look like this:
ffmpeg -i <input_movie> frame_%06d.jpg
This will split the movie up into single frames named frame_000001.jpg, frame_000002.jpg... frame_00000n.jpg. As you can imagine, you'll end up with a ton of frames.
Both FFMPEG and Mencoder allow you to build videos from frames. The kicker here is FFMPEG will crap out if you add anything in between these frames. For instance, if you add frame_0000015 to try to get it in between frame_000001 and frame_000002, FFMPEG will not only not do it, it will stop encoding. You'll have to do something like rename all the files in the directory to get the right sequence. Mencoder is much more forgiving than that; It uses a true glob pattern.
The trouble with this methods is it will change the frame rate in the end. If you want your one minute long video to remain that way, you'll have to account for the added frames during re-encoding. This can create sync problems with audio. Also, if you hack a movie to pieces and then put it back together, you'll be remuxing the files. This means loss in quality.
Adding in whole movie chunks is a lot easier if your mp4 files are ISO compliant. MP4Box for GPAC (in AUR) has awesome splitting and concatenation abilities. But, audio may be an issue here also.
If any of this seems like it's want you want, I'll help the best I can.
Last edited by skottish (2007-08-06 01:32:34)
Offline
Thanks much for the info on ffmpeg.
Not sure what mencoder has in this area.
I would be hoping to preserve the audio sync but add jpeg image(s) to the front or end of the video file.
Most of my attempts involved setting up repetitive frames of 640x480 jpeg frames at 30fps but no audio. The result was unsuccessful as I recall because I had no audio since the encoder expected the audio definition to apply at the start. I didn't pursue it further at the time.
I may "borrow" some audio from the existing video to add to the frames and thusly get a correct start. This may be all I need.....
I have used mencoder to produce the mpeg4v2 .avi files which I have joined into one larger file which encourages me to continue searching for the jpeg solution since the jpeg pix add much to the video content accenting the decor and presence and theme of the video.
These videos are the product of my panasonic cccd digital camera which has been translated to .avi through mencoder.
You might comment on the added audio to the 30fps,640x480 jpeg frames...it takes about 400 frames for a good intro display as I recall.
I certainly need the audio synced during the video portion so the definition needs to be correct for the video file...obviously the same ID for the added jpeg frames prior to the video.
The same may not apply for frames added to the end of the video files, audio def has been accomplished and none is provided with just jpeg frames added.
So mencoder could provide jpeg to .avi @ 30fps, 640x480 for 400 frames and the audio added from the contents of the video files which has the correct pcm arrangement.
Crazy...no?
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
You can create a silent audio track with FFMPEG. This example creates a 3600 second (1 hour) silent m4a file. You'll need to adjust it to your audio file type and bitrate from your movies:
ffmpeg -ar 48000 -t 3600 -f s16le -acodec pcm_s16le -i /dev/zero -ab 64K -f m4a -acodec m4a -y silence3600.m4a
Offline
Couldn't you create a small avi with the png/jpeg then stitch the 2 avis together with
mencoder jpeg.avi sound.avi -ovc copy -oac copy -o mixed.avi
Code for mencoder for stitching png's or jpeg's
mencoder mf://*.jpg -mf w=640:h=480:fps=30:type=jpg -ovc lavc -lavcopts vcodec=mjpeg -oac copy -o mjpeg.avi
I've chosen the mjpeg codec mainly because if you want further control perhaps something like cinelerra(Which from my little experimenting only likes mjpeg), lives or kino or maybe even avidemuxer may help further.
From what I can work out the hardest bit is making sure both avi formats are the same.
Last edited by FeatherMonkey (2007-08-06 13:20:29)
Offline
Fethermonkey;
Have been experimenting with the format you posted in another form with no success, however with some changes derived from your post, I generated a ten second file of a single jpg image.
The code for my attempt is as follows;
mencoder mf://@list.txt -mf w=640:h=480:fps=30:type=mpeg4 -ovc lavc -lavcopts vcodec=mpeg -o output2024.avi
This produces with my list.txt a 299frame series of a single jpeg image (640x480). However, the output format is fmp4 and may not be compatible with mpg4 video.
A further conversion step may be necessary. The video generated by the above mencoder command plays in Mplayer.
I will attempt to join this file with a video file using this file as the opener.
Progress!
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
All I can add is you should be able to use a similar format and change the vcodec, man mplayer has the options but just make sure both files use the same codec, and pic size.
So if you had an fmp4.avi, here I'd really resort to putting both as mjpeg but I guess this is a personal choice, for which codec. Just re-encode the sound.avi so the vcodec is the same.
mencoder fmp4.avi -ovc lavc -lavcopts vcodec=mjpeg -oac copy -o mjpeg.avi
At least I think it'll work but really haven't played too much, I was trying to create vids from pics so quite a bit different from what you want to achieve.
Edit
I'm quite surprised the command you used worked firstly you have type=mpeg4 this should be the type of image me I've used png's and jpeg's. The other thing there's no vcodec mpeg, either this is a typo, but as you said its got mpgv4 sounds like its resorted to the default encoding of mencoder.
Also in checking the first command it's correct as long as the pics have a numerical numbering scheme, though I had to change it to png for my folder..
Last edited by FeatherMonkey (2007-08-06 17:18:00)
Offline
Feathermonkey;
Attempted to intro with the fmp4 file and follow with the mpg4 video but the two must be identical in order to join them.
The video is derived from a digital camera and has afm:pcm 8000hz audio (non-stereo).
I cannot use the fmp4 file as a follower either due to the difference in codec. Either of the two files fmp4 or the mpg4 play in mplayer separately.
I may tru a cat command next and see what happens....
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
CAt is even more fussy I think.
The above command should convert them so if you wish for fmpv4 change the vcodec to mpeg4.
Then run both files through it the one with sound and the jpeg now both will have the same encoding.
These are all the codecs that vcodec will use so use the right one, I don't know what the codec the cam recording is, but I'm sure one may be close. So if you change the vcodec to one of these choices you'll end up with the same codec on both.
Just make both files have the same encoding, re-encode the cam recording or encode the jpeg one with the right one or re-encode both, but not all will take pics as a source file.
mjpeg
Motion JPEG
ljpeg
Lossless JPEG
h261
H.261
h263
H.263
h263p
H.263+
mpeg4
MPEG-4 (DivX 4/5)
msmpeg4
DivX 3
msmpeg4v2
MS MPEG4v2
wmv1
Windows Media Video, version 1 (AKA WMV7)
wmv2
Windows Media Video, version 2 (AKA WMV8)
rv10
an old RealVideo codec
mpeg1video
MPEG-1 video
mpeg2video
MPEG-2 video
huffyuv
HuffYUV
ffvhuff
nonstandard 20% smaller HuffYUV using YV12
asv1
ASUS Video v1
asv2
ASUS Video v2
ffv1 (also see: vstrict)
FFmpeg's lossless video codec
flv
Sorenson H.263 used in Flash Video
dvvideo
Sony Digital Video
svq1
Apple Sorenson Video 1
snow (also see: vstrict)
FFmpeg's experimental wavelet-based codec
So change the the
Offline
The standard cat command will let one concatenate a very select group of videos, but the time stamp will be wrong. It will have to be run Mencoder in order to fix that. I believe that this only works for MPEG1 and 2 though.
Offline
Gents;
Very fine info from both of you.
I have reconverted the original video to mjpeg and encoded the jpeg image to mjpeg.
This permitted the joining of the two files with the jpeg image of ten seconds to precede the video file with - no sound.... option.
The video file plays OK in m,jpeg with audio in sync(AFAICT).
Now I have to add sound to the jpeg ten second intro file so that the result is compatible and all is correct.
I will try the suggested sound CLI and see if it is compatible with the jpeg file(mjpeg).
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
Where the mencoder command says -oac if you look at the man mplayer you'll see various audio formats for acodec, again I suspect just make sure both are using the same codec.
There is a way to stitch audio into the file of the top of my head think you can use as above but have the audio and the jpeg.avi as the in files. really not 100% sure but think like this
mencoder sound.mp3 jpeg.avi -ovc lavc -lavcopts vcodec=mjpeg -oac copy -o mjpeg.avi
You may have to play with the -oac bit perhaps, but I suspect it'll point you in the right direction.
Edit
I also suspect you'll want to re-encode the final file as I'm sure the mjpeg format is huge in relation to some of the others only beaten by ffvhuff or was it the other one. Though I honestly can't remember just remember trying all the available ones and checking the diff in final size.
Just play with the final codecs but I'd try to keep them the at there highest quality till the final rendering as I suspect there's some loss going on.
As for doing this in the middle think you really will be involving stripping it down to pics and loading it into a vid editor like cinelerra. Though I briefly tried to insert a pic into the middle of an avi with cinelerra, I do suspect it'll get really messy with the sound stream(Though this could be independent, which may aid insertion).
Also not sure whether it worked it popped onto the end fine but the file was too big to be conclusive whether inserting in the middle did actually work. I have to admit as it wasn't my problem I didn't really investigate further. I suspect the easiest may be as suggested and find a tool that'll cut the avi into chunks for you, I suspect mplayer would but really haven't got a clue how.
Any way glad you're getting closer
Last edited by FeatherMonkey (2007-08-06 21:51:12)
Offline
Using mjpeg for both files and adding a wav file audio to the jpeg file, I was able to join them in a 9 minute playing file.
I used avidemux to add the wav file to 15 jpeg joined files, each of 10 seconds duration so the wav file ends as the video files are terminated. The video file originally was a quicktime file and it plays well to finish out the nine minute playing time.
I may not have any luck in changing this to another codec.
I am burning a cd-R first.
Many thanks for the aid and comfort!!!
EDIT: The cd is 600MB and it seems it plays in VLC and Mplayer but only audio in kaffeine and kaboodle. Have to see about windows media player soon.
Last edited by lilsirecho (2007-08-07 10:10:19)
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
You really shouldn't have an hassle changing the final avi it should just be fed into mencoder and back out re-encoded, with the codec you wanted. I changed quite a few to mjpeg 4 and back to various formats and didn't have any troubles but I wasn't looking for sync problems.
As you said mplayer can play it then mencoder can re-encode it, give it a try, you won't lose the original unless you write over it, I played with all the mencoder available codecs.
but if you got problems with kaffeine I suspect you'll have the same problems with wmp can't honestly remember what wmp does play, perhaps you'll be lucky, long time since I tried
But glad you got it sorted
Offline
Tried mencoder recoding to mpeg4 and received a 69MB file of fmp4. It plays in mplayer.
Will try the CD's on wmp later today.
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
Was able to utilize a mencoder command to re-encode the 600MB file to msmpeg4 v2 as below;
mencoder /root/output2055.avi -oac pcm -vf scale=640:-11 -ovc lavc -lavcopts vcodec=msmpeg4v2 -o /root/output2060.avi
File 2055 was 600MB mjpeg.
This plays in wmp and is 70MB.
I plan to add more to this at a later time.
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline
Further efforts with encoding has produced results in the msmpeg4v2 codec.
I utilized the format below for all conversions of quicktime and mjpeg frame series;
mencoder {input file quicktime,etc .avi) -oac pcm -vf scale=640:-11 -ovc lavc -lavcopts vcodec=msmpeg4v2 -o {output file.avi}
There may be others that do it better?
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline