help cleaning up bad video
Hi, I am using the windows version 15666 from svn on xp and vista. I am getting mpeg-2 videos(720x480, ntsc, interlaced, 3000kbs) captured by Hauppauge cards from a video camera. Changing out the video camera and the card is not an option for us at this time. The original mpeg files have a sort of moir? effect in them and look a little blocky and have that "vibration" to them that you sometimes get. If I use the following command to resize them to 360x240, the moir? goes away and they even look pretty good zoomed 200% back to 720x480 during playback. It almost looks better than the original because the vibrations are gone, but some of the detail is gone, and I want to keep it if possible. e:\video_testing\FFmpeg-svn-15666\ffmpeg -i e:\video_testing\orig.mpg -acodec libfaac -ab 44100 -vcodec libx264 -b 3000000 -s 360x240 -g 600 -bf 3 -b_strategy 1 -subcmp 2 -cmp 2 -coder 1 -flags +loop -qmax 25 -deinterlace e:\video_testing\orig.1.mp4 Are there any commands I can pass to keep the video at 720x480 but remove the moir? and other artifacts? Thanks, Bob
Ramsey, Robert L wrote:
Hi,
I am using the windows version 15666 from svn on xp and vista. I am getting mpeg-2 videos(720x480, ntsc, interlaced, 3000kbs) captured by Hauppauge cards from a video camera. Changing out the video camera and the card is not an option for us at this time.
The original mpeg files have a sort of moir? effect in them and look a little blocky and have that "vibration" to them that you sometimes get.
If I use the following command to resize them to 360x240, the moir? goes away and they even look pretty good zoomed 200% back to 720x480 during playback. It almost looks better than the original because the vibrations are gone, but some of the detail is gone, and I want to keep it if possible.
e:\video_testing\FFmpeg-svn-15666\ffmpeg -i e:\video_testing\orig.mpg -acodec libfaac -ab 44100 -vcodec libx264 -b 3000000 -s 360x240 -g 600 -bf 3 -b_strategy 1 -subcmp 2 -cmp 2 -coder 1 -flags +loop -qmax 25 -deinterlace e:\video_testing\orig.1.mp4
Are there any commands I can pass to keep the video at 720x480 but remove the moir? and other artifacts?
Thanks,
Bob _______________________________________________ ffmpeg-user mailing list ffmpeg-user at mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
I have been delving into modifying videos as well. My solution was to export all frames to some raster format and then using imagemagick, and other such batch capable tools, to filter them. I would then reassemble the individual frames using ffmpeg; putting the sound back of course. I made a bash batch script that I use to convert 10fps videos to 30fps. I use TARGA files as my intermediate step since the color information is easy to read from that format. That makes it quite easy for me to read and write frames and make simple applications in C to manipulate colors or pixels. ##################################################### #!/bin/bash FRAMES_PER_SECOND=10 for FILE in `ls *.avi`;do ODIR=`echo "$FILE" | sed -e "s/\.avi//g"`; mkdir $ODIR; cp $FILE $ODIR; cd $ODIR; rm *.jpg; rm *.png; for FRM in `seq 1 300`;do TM=`echo "$FRM"|awk '{ms=($0-1.0)/10.0;printf("00:00:%3.1f",ms)}'`; echo "TM=$TM"; for M in `seq 1 3`;do OFILE=`echo "$FRM|$M"|awk -F "|" '{T=(($1-1)*3)+($2-1);printf("img%0.4d.png",T);}'`; echo "$OFILE"; ffmpeg -y -i $FILE -vframes 1 -ss $TM -an -vcodec png -f rawvideo -s 640x480 $OFILE; done done for PNG in `ls *.png`;do TGA=`echo "$PNG"|sed -e "s/png/tga/g"`; convert $PNG $TGA; done rm *.png; rm *.mpg; MPG=`echo "$ODIR" | awk '{print $0 "_30fps.mpg"}'`; ffmpeg -sameq -f image2 -i img%04d.tga -r 30 $MPG rm *.tga; cd ..; break; done Many places use gaussian blur to remove moire and speckle. If that's what you're looking for the 'mogrify' command from the imagemagick suite can probably be set up to filter: http://www.imagemagick.org/script/mogrify.php ########################################## #!/bin/bash WORK_DIR="/my/work/directory" cd "$WORK_DIR"; for VFILE in ``;do ffmpeg -f image2 -i img%04d.tga IMG_0621_30fps.mpg mogrify -gaussian 3 *.tga done Have fun. P
pwillis wrote:
########################################## #!/bin/bash
WORK_DIR="/my/work/directory"
cd "$WORK_DIR";
for VFILE in ``;do ffmpeg -f image2 -i img%04d.tga IMG_0621_30fps.mpg mogrify -gaussian 3 *.tga
done
Oh, sorry about that. This particular script was a work in progress. The 'mogrify' command is what would be of interest though.. P
Hi, Ramsey, Robert L said:
Hi,
I am using the windows version 15666 from svn on xp and vista. I am getting mpeg-2 videos(720x480, ntsc, interlaced, 3000kbs) captured by Hauppauge cards from a video camera. Changing out the video camera and the card is not an option for us at this time.
The original mpeg files have a sort of moir? effect in them and look a little blocky and have that "vibration" to them that you sometimes get.
If I use the following command to resize them to 360x240, the moir? goes away and they even look pretty good zoomed 200% back to 720x480 during playback. It almost looks better than the original because the vibrations are gone, but some of the detail is gone, and I want to keep it if possible.
e:\video_testing\FFmpeg-svn-15666\ffmpeg -i e:\video_testing\orig.mpg -acodec libfaac -ab 44100 -vcodec libx264 -b 3000000 -s 360x240 -g 600 -bf 3 -b_strategy 1 -subcmp 2 -cmp 2 -coder 1 -flags +loop -qmax 25 -deinterlace e:\video_testing\orig.1.mp4
Are there any commands I can pass to keep the video at 720x480 but remove the moir? and other artifacts?
You may feed ffmpeg with an Avisynth script (see FAQ) that runs the filtering of your choice. Or pipe as yuv4mpegpipe to some yuv tools in the mjpegtools package. Regards, V?ctor
participants (3)
-
p.willis@telus.net -
robert-ramsey@uiowa.edu -
wzrlpy@arsystel.com