Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: BG Davis on May 06, 2016, 03:19:18 PM

Title: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 06, 2016, 03:19:18 PM
Avidemux v2.5.6 allowed users to save a segment of a video clip as a series of JPEG images (for use in creating animated GIF).
This function has been removed from v2.6, leaving only the option of saving one frame at a time as either JPEG or BMP.
Is there any way to request that this very useful function be restored?

Meanwhile, does anyone know of a workaround?

Thanks
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 06, 2016, 06:57:44 PM
Mark section from you want picture from video [A ] [ B], and save as new video.
ffmpeg -i YourNewVideo.ts -r 50 -s hd1080 -f image2 image-%3d.png
-r 50 = framerate

other examples are around on the web doing this with ffmpeg
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 06, 2016, 11:53:36 PM
Thanks for the suggestion; I had some problems when I tried it with AVCHD 1080/60p video.

1. Got error messages, including lack of support for 60p (which is what I always use if I'm going for frame caps).
Screen shots of error messages attached.

2. Didn't see any way to use the string you provided; once I had selected ffmpeg the "Configure" button for Video Output was deactivated.

Did you mean to use the DV (ffmpeg) option under Video Output, or some other path?  I have never done anything with ffmpeg before and therefore have no familiarity with its use.

Thanks
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 06, 2016, 11:55:21 PM
Second attachment failed to post.  Here it is.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 07, 2016, 04:55:29 AM
ffmpeg is a standalone program, run from commandline.
- mark and save the wanted with [Copy] for both Video and Audio Output the videosegment (avidemux) as YourNewVideo.ts.
Replace the extension .ts with the original one from the source video. Do the sam in the command line below.
from commandline with ffmpeg:
ffmpeg -i YourNewVideo.ts -r 60 -s hd1080 -f image2 image-%3d.jpg
If not working with jpg use png.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 07, 2016, 03:29:21 PM
Thank you for your patience.  Since I have never done anything with command line I am not familiar with how it is used.
Starting from the top:
1. The only option I find in the Avidemux program is "Tools>Scripting Shell."  Is this the correct path?
2. To keep things simple, I copied and pasted the sample command that you provided.  I tried both .jpg and .png extensions.  I got error messages for both when I selected "Evaluation."  (Screen shots attached.)
3. I could find no option in Avidemux for saving with .ts extension.  The only option I have is .avi.  (Screen shot attached.)
I seem to have hit a dead end.  :-[
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 07, 2016, 03:31:30 PM
Additional screenshots (the max size allowed is very low).
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 07, 2016, 05:29:28 PM
NOTES:
Downloaded ffmpeg from https://ffmpeg.org/

Could not open file with any program on my computer, including Avidemux.  So no way to use it.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 07, 2016, 05:34:07 PM
Not in avidemux.
You need to install ffmpeg for your Operating Sysytem
From windows command prompt, or
Linux terminal window ([Ctrl] [Alt] [T]

If source video has extension:
- .avi save video selection with AVI Muxer
- .mp4 save video selection with MP4 or MP4v2 Muxer
- .mkv save video selection with MKV Muxer
- ...
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 08, 2016, 02:56:17 PM
Thank you!  I will give it a try.  (I'm more a photographer and video/photo processing person and not a computer guy, so it may be an adventure.)
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 08, 2016, 04:09:08 PM
We all had to start somewhere.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 09, 2016, 05:08:42 PM
After all this I downloaded v2.5.6.  It does the multiple JPEG frame save, but it is temperamental.
Some things I have found:
--WMV works best, MP4 is conditional (depends on the clip), .avi is very unstable.
--It seems to prefer smaller frame sizes.  A 720 video (including 120fps) seems to function no matter what the format.  But some small (640) .avi files play perfectly; others do not (trying to Play causes immediate crash.  You must advance the frames with the directional arrow).  These files were all shot with the same camera at about the same time.
--4K video can be processed, but won't play - you must advance the frames with the directional arrow.
--AVCCH 1080/60p can't be played (crashes).  You must advance the frames with the directional arrow.  You can't reverse or retreat; the program will freeze or crash.
I'm still sorting out what works and what doesn't.  When it does work, it's very nice to be able to get a series of JPEG frame captures for creating animated GIFs, selecting stills, etc.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 09, 2016, 05:11:41 PM
2.5.6 has issues reading/processing most newer encodings.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 11, 2016, 06:17:13 PM
"2.5.6 has issues reading/processing most newer encodings."
It certainly does!   :P
I will get into the command line for 2.6.x as soon as I can get around to it.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 12, 2016, 10:54:57 PM
Good news, puzzling news.
The good: I got the ffmpeg program working and it did a fine job of saving frame sequences in JPEG, BPM, PNG.
The puzzling: I tried to do frame caps from a 4K video, inserting [2160] instead of [1080].  The program kept giving me "incorrect frame size" error messages so I ran it with [1080] and it generated the sequence.  But of course they are all 1080 size (2MP) images, which negates the benefit of shooting 4K.
Is there a way to get around this?  It would be nice to get the 8MP frames.  (I tried both [hd2160] and [uhd2160] with the same result.)

Footnote: I was able to do frame caps from 120fps video with different frame rates (120, 60, 30) specified in the string.  The number of frames was reduced proportionately (68 frames, 34 frames, 17 frames in my test sample).
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 13, 2016, 09:00:33 AM
make sure you have 64-bit version of ffmpeg (could be a 32-bit issue)
try with the resolution of the source video:
Quote3840 Ãâ€" 2160 Ultra-high-definition television
5120 Ãâ€" 2160 Ultra-wide-television
4096 Ãâ€" 2160 DCI 4K (native resolution)
4096 Ãâ€" 1716 DCI 4K (CinemaScope cropped)
3996 Ãâ€" 2160 DCI 4K (flat cropped)
like -s WxH
-s 3996x2160

source: 6.3 Video and Audio file format conversion (http://ffmpeg.org/ffmpeg.html#toc-Video-and-Audio-file-format-conversion)
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 13, 2016, 05:27:42 PM
I'll give it a try.
The original 4K frames from my camera are 3840x2160, so I will use that.
I notice that according ffmpeg, "Images will be rescaled to fit the new WxH values. "
I'm not trying to rescale anything, just capture what I have--we'll see what happens.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 13, 2016, 07:40:30 PM
OK, I did it.
Results were mixed.
I captured 3 versions of the same frame.
1. Using sequence capture with ffmpeg, save as JPG.  Then crop and save as TIF for comparison of details and IQ.
2. Using sequence capture with ffmpeg, save as PNG.  Then crop and save as TIF for comparison of details and IQ.
3. Using single frame capture with Avidemux, save as JPG.    Then crop and save as TIF for comparison of details and IQ.
So there are 3 TIF files, all the same dimensions, from different sources.
Results:
1. The ffmpeg JPG file is pretty bad.  Lots of artifacts, very poor detail.
2. and 3.  The single frame capture as JPG is actually better than the sequential frame capture as PNG, but the results are very close and both are acceptable.
Conclusion: there appears to be some sort of resampling going on during the sequential capture (hence the "wrong size" messages).
I have saved a rather long string of output messages generated by the sequential (ffmpeg) save.  Can I send them to you so you can look at them to see what might have happened?  (It's all Greek to me.)
I would attach comparison images, but since the file sizes allowed are so minuscule they would be useless.
My personal conclusion: sequential frame capture of 4K video is probably acceptable for most uses (animated GIF, small prints, etc.) if saved as PNG.  I didn't try BMP save on this test but prior experience with BMP save from Avidemux yielded excessive contrast, blown highlights and general lack of subtlety in the images.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 14, 2016, 05:56:13 AM
I'm not ffmpeg an expert.
Use -qscale:v (http://stackoverflow.com/questions/10225403/how-can-i-extract-a-good-quality-jpeg-image-from-an-h264-video-file-with-ffmpeg)

4.3 Extract Frame at given timecode location "Flag option ââ,¬Å"-qscale 0ââ,¬Â is used to keep the quality intact" (http://www.mediaentertainmentinfo.com/2015/06/5-technical-series-handy-ffmpeg-commands-to-get-your-video-processing-done.html/)

Apparently overlooked this "Images will be rescaled to fit the new WxH values. " in regards to "-s 3996x2160"

also look at 7.4 Video size (https://ffmpeg.org/ffmpeg-all.html#Video-size) uhd4320, uhd2160, 4kdci

sadly i did not find how to use Video size in relation to extract jpg with the same resolution.
QuoteI would attach comparison images, but since the file sizes allowed are so minuscule they would be useless.
take a free account on webservice like dropbox and upload there.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 14, 2016, 07:53:49 AM
done some testing here with uhd video clip and ffmpeg:
with ffprobe you can find out the details of the video you want to process like:
ffprobe hevcUHD3840x2160-25fps.mkv
QuoteStream #0:0: Video: hevc (Main 10), yuv420p10le(tv), 3840x2160 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 25 tbc (default)
yuv420p10le(tv) is most likely to loose colour depth going to png or jpg (using another colorspace)

Extracting one frame with ffmpeg:
--------------------------------------
to jpg
ffmpeg -ss 00:00:36.0 -i hevcUHD3840x2160-25fps.mkv -vframes 1 -qscale 0 -r 25 -s uhd2160 -f image2 image-%3d.jpg
giving 987,4 kB file, download by clicking top hand right download: hevcUHD3840x2160-25fps.jpg (https://www.dropbox.com/s/rwj4m61xi48mdhj/hevcUHD3840x2160-25fps.jpg?dl=0)

to png
ffmpeg -ss 00:00:36.0 -i hevcUHD3840x2160-25fps.mkv -vframes 1 -qscale 0 -r 25 -s uhd2160 -f image2 image-%3d.png
giving 33,9 MB file, download by clicking top hand right download: hevcUHD3840x2160-25fps.png (https://www.dropbox.com/s/oeh5yd252r1le36/hevcUHD3840x2160-25fps.png?dl=0)

- you need to repace 'hevcUHD3840x2160-25fps.mkv' with the name of your video.
- most likely we're not to see any difference on none 4k HDR monitor

jpg:
(https://photos-1.dropbox.com/t/2/AACinarfS9Gi3R4WwPmbyx206JyQfXgrxz1rXJZ98OZNQA/12/240010204/jpeg/32x32/3/1463227200/0/2/hevcUHD3840x2160-25fps.jpg/EPTXu9QBGOIFIAIoAg/YivN048IM1BfEeehRsXSC1wOzGA33R6SZ7sHDCifntY?size_mode=3&size=2048x1536)
png:
(https://photos-3.dropbox.com/t/2/AABK7bJoX2bDrpxqYfJX43NGTQf85KofnLTaCN445zj77g/12/240010204/png/32x32/3/1463227200/0/2/hevcUHD3840x2160-25fps.png/EPTXu9QBGOIFIAIoAg/he1HRBIkLS-wvxv69vNBN_sFnUJW7fS7t4EuP4AOjfo%2Cp7Rcu2967Fx2C7VDo8VkM1fQjYuFKAkfXC0VHdxVI6M%2Cwnc60a3bsFE1Cm3bKdo_6e-jNLsKMGwCXc2XOtmsGVU%2CnsUAj-ZW7um9K-GtiED4MLDn0eRdJjnk4v8c78QLc-c%2CXu9kdLQ_bVhE1dKMlcqSdFhGKauMsbjBCgVLse0GNd4%2CJP0QsGlUyreIe3M3dfRq6WBo5YHPhUPQswD3YPtnFRY%2CmksiRDzJmTkywq0IoKXl1mmqJYnYGikzAHMB_puQc48%2CnJmqUjAtBYJEYkiDIW3A1BX37A2tnmmAABlSDTAvxZ0%2CTeYuJ8KwUMeYd4eExvYpNlufOYiOQjrGlcGxkk1Fbw8?size_mode=3&size=2048x1536)
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: BG Davis on May 15, 2016, 03:29:04 AM
Thank you for all your input on this issue; you have taught me a lot.
With the PNG save I have gotten output that is actually good enough for my current purposes, so for now I'm going to let this lie and move on to other things.
4K video is a very interesting format and I'm still exploring the various possibilities.  At the same time, I tend to have rather high expectations of results, and yet the fact is that 8mp frame caps from 4K video are not going to be museum-quality photo art.  :P
Sometimes good enough is...well, good enough. ;D
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: AQUAR on May 15, 2016, 10:06:22 AM
Long time ago I read that a 35 mm photographic image holds the equivalent of between 20 to 50 Mega pixels.
Current consumer grade SLR cameras are getting close to those figures.
Title: Re: Any chance of restoring 'File > Save > Save Selection as JPEG Images' function?
Post by: Jan Gruuthuse on May 16, 2016, 04:38:04 AM
Like a $1800 Ricoh Pentax K-1 full-frame DSLR with 36MP sensor (http://www.dpreview.com/news/5348800158/here-at-last-ricoh-unveils-the-pentax-k-1-full-frame-dslr) ;)