FAQ  •  Register  •  Login

Automatic Resize of large photos

<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Tue Jun 25, 2013 1:32 am

Automatic Resize of large photos

Is it possible to automatically resize photos that are served to a device by a percentage factor?

WDTV Live can only handle the following dimensions for the following formats...
JPEG only supports compressed RGB format files. BMP only supports uncompressed files. TIFF only supports single layer files. BMP, TIFF/TIF, PNG, and GIF have a max resolution of 2048x2048. JPEG/JPG has a max resolution of 4096x4096 unless it is in a progressive format, then maxes out at 1280x720.

from: http://wdc.custhelp.com/app/answers/detail/a_id/2698/p/208,393/session/L3RpbWUvMTM3MjEyMzY5MS9zaWQvdW1OYlBBdGw%3D

I have many really large photos that are not displaying on WDTV Live. The thumbnails appear on the menu but when I open them up I get a blank screen. Sometimes they may appear but only for a brief moment then vanish.

For resizing, I was thinking of something like this... psuedocode...
while (dimensions > 1920x1080) // 1080 horizontal lines should cater for all my devices.
{
resizeByFactor(<some_%>); // some_% perhaps 95% so it doesn't stray too far away from 1080 based on the arbitrary value of "dimensions"
}
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jun 25, 2013 7:09 am

Re: Automatic Resize of large photos

DanglingPointer wrote:WDTV Live can only handle the following dimensions for the following formats...
JPEG only supports compressed RGB format files. BMP only supports uncompressed files. TIFF only supports single layer files. BMP, TIFF/TIF, PNG, and GIF have a max resolution of 2048x2048. JPEG/JPG has a max resolution of 4096x4096 unless it is in a progressive format, then maxes out at 1280x720.

I have many really large photos that are not displaying on WDTV Live. The thumbnails appear on the menu but when I open them up I get a blank screen. Sometimes they may appear but only for a brief moment then vanish.

With "LimitImageResolution" option- If 'true' Serviio will resize images whose resolution is higher than 4096x4096 (specification maximum resolution).

With JPEG_LRG profile (DLNA standard) the resolution of the image must not exceed 4096 pixels in the ImageWidth field and must not exceed 4096 pixels in the ImageHeight field.
But the standard does not talk about "progressive" format. This profile also only support compressed RGB format.

But I think that serviio does not distinguish progressive/ non-progressive JPEG format.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Tue Jun 25, 2013 7:40 am

Re: Automatic Resize of large photos

Thanks for the reply Illico!
I'm at work at the moment and can't check property/config files. Which file is that in? ("LimitImageResolution")

I'll check when I get home.

On another note, would I be able to resize by percentage using the property/config files? I suppose I would not need any above 1080 which is the maximum output of all our TV's.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jun 25, 2013 7:51 am

Re: Automatic Resize of large photos

If you open ../serviio/config/profiles.xml
You will find the <Profile id="14" name="WDTV Live" extendsProfileId="1"> section.
As you can see this profile inherite from the "Generic profile"/
And in "Generic profile", the option is set to "TRUE" : <LimitImageResolution>true</LimitImageResolution>

So with your device Serviio will resize images whose resolution is higher than 4096x4096. But as I said, I'm not sure that serviio distinguish progressive/non-progressive JPEG.

Could you provide informations about your large photos that are not displaying on your WDTV Live ?


You can also try this (backup profiles.xml, edit,save, then restart serviio service or reboot PC):
- JPEG with YUV444 subsampling will be transcoded...
  Code:
   <Profile id="14" name="WDTV Live" extendsProfileId="1">
      <Detection>
         <UPnPSearch>
            <ModelName>WD TV HD Live</ModelName>
         </UPnPSearch>
      </Detection>
      <ContentDirectoryMessageBuilder>org.serviio.upnp.service.contentdirectory.PacketVideoDLNAMessageBuilder</ContentDirectoryMessageBuilder>
      <Transcoding>
         <Video targetContainer="mpeg">
            <Matches container="wtv" />
         </Video>
         <Video targetContainer="mpeg" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="384">
            <Matches container="flv" /> <!-- this is used by online content, assuming WDTV cannot play local flv either -->
            <Matches container="matroska" vCodec="vp8" />
            <Matches container="rm" />
         </Video>
         <Image>
            <Matches container="jpeg" subsampling="YUV444" />
         </Image>
         </Transcoding>
         <OnlineTranscoding>
         <Video targetContainer="mpeg" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="384">
            <Matches container="mp4" />
            <Matches container="asf" /> <!-- for mms:// -->
         </Video>
      </OnlineTranscoding>   
      <Subtitles>
         <SoftSubs mime-type="text/srt" />         
      </Subtitles>
   </Profile>
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Tue Jun 25, 2013 9:14 am

Re: Automatic Resize of large photos

The images are mostly 4896x3672. The properties do not say if they are progressive or not. Would you know how to tell?

I tried the new profile and it didn't work unfortunately. I get the same response from the device.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jun 25, 2013 9:50 am

Re: Automatic Resize of large photos

DanglingPointer wrote:The images are mostly 4896x3672. The properties do not say if they are progressive or not. Would you know how to tell?


Could you provide information from MediaInfo tools result (in text format) ?
I don't know for progressive information...
EDIT1:
Here : http://en.wikipedia.org/wiki/JPEG#Syntax_and_structure
if you open your JPEG in hexa editor try to find these occurance : 0xFFC0 is a standard frame, 0xFFC2 is a progressive frame

EDIT2: With http://www.irfanview.net/ you can see if JPEG is progressive or not (see image Information tab)

EDIT3: with "ffmpeg -report -i <JPEG>" , marker=c0 if for standard frame, marker=c2 is for progressive frame


Could you test with profile above ?
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Tue Jun 25, 2013 12:07 pm

Re: Automatic Resize of large photos

Underneath is the report from "ffmpeg -report -i". In green are the two strings most similar to what you are asking.

I installed Phatch and batch converted the originals to two different sets.
1) to 4096x3072 --> did not display on device - deleted the batch
2) to 1920x1080 --> all displayed correctly - keeping the batch for WDTV Live

Is there some sort of config I can paste into the profile that would automatically resize to 1080? That way I won't have to keep duplicates (master copy and smaller resize).

ffmpeg started on 2013-06-25 at 21:53:16
Report written to "ffmpeg-20130625-215316.log"
Command line:
ffmpeg -report -i DSC00932.JPG
ffmpeg version git-2013-06-23-cc61ef0 Copyright (c) 2000-2013 the FFmpeg developers
built on Jun 23 2013 21:30:48 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-librtmp --enable-libxvid --enable-libass
libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 16.100 / 55. 16.100
libavformat 55. 9.100 / 55. 9.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input file with argument 'DSC00932.JPG'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file DSC00932.JPG.
Successfully parsed a group of options.
Opening an input file: DSC00932.JPG.
[AVIOContext @ 0x28a1340] Statistics: 6186151 bytes read, 0 seeks
[mjpeg @ 0x28a17e0] marker=d8 avail_size_in_buf=6186149
[mjpeg @ 0x28a17e0] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x28a17e0] marker=e1 avail_size_in_buf=6186147
[mjpeg @ 0x28a17e0] marker parser used 53379 bytes (427032 bits)
[mjpeg @ 0x28a17e0] marker=e2 avail_size_in_buf=6132765
[mjpeg @ 0x28a17e0] marker parser used 373 bytes (2984 bits)
[mjpeg @ 0x28a17e0] marker=db avail_size_in_buf=6132389
[mjpeg @ 0x28a17e0] index=0
[mjpeg @ 0x28a17e0] qscale[0]: 1
[mjpeg @ 0x28a17e0] index=1
[mjpeg @ 0x28a17e0] qscale[1]: 1
[mjpeg @ 0x28a17e0] marker parser used 132 bytes (1056 bits)
[mjpeg @ 0x28a17e0] marker=c4 avail_size_in_buf=6132255
[mjpeg @ 0x28a17e0] class=0 index=0 nb_codes=12
[mjpeg @ 0x28a17e0] class=1 index=0 nb_codes=251
[mjpeg @ 0x28a17e0] class=0 index=1 nb_codes=12
[mjpeg @ 0x28a17e0] class=1 index=1 nb_codes=251
[mjpeg @ 0x28a17e0] marker parser used 418 bytes (3344 bits)
[mjpeg @ 0x28a17e0] marker=c0 avail_size_in_buf=6131835
[mjpeg @ 0x28a17e0] sof0: picture: 4896x3672
[mjpeg @ 0x28a17e0] component 0 2:1 id: 0 quant:0
[mjpeg @ 0x28a17e0] component 1 1:1 id: 1 quant:1
[mjpeg @ 0x28a17e0] component 2 1:1 id: 2 quant:1
[mjpeg @ 0x28a17e0] pix fmt id 21111100
[mjpeg @ 0x28a17e0] marker parser used 17 bytes (136 bits)
[mjpeg @ 0x28a17e0] escaping removed 625087 bytes
[mjpeg @ 0x28a17e0] marker=da avail_size_in_buf=6131816
[mjpeg @ 0x28a17e0] component: 0
[mjpeg @ 0x28a17e0] component: 1
[mjpeg @ 0x28a17e0] component: 2
[mjpeg @ 0x28a17e0] marker parser used 5506728 bytes (44053822 bits)
[mjpeg @ 0x28a17e0] marker=d9 avail_size_in_buf=600339
[mjpeg @ 0x28a17e0] decode frame unused 600339 bytes
[image2 @ 0x28a0900] Probe buffer size limit of 5000000 bytes reached
[image2 @ 0x28a0900] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, image2, from 'DSC00932.JPG':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0, 1, 1/25: Video: mjpeg, yuvj422p, 4896x3672, 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
At least one output file must be specified
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jun 25, 2013 12:25 pm

Re: Automatic Resize of large photos

Thanks for your reports.

OK, so your JPEG seems to be a standard baseline DCT (non-progressive), but its a 4:2:2 subsampling. Do you know if your device support it ? (For example Sony devices does not support 4:2:2, but only 4:2:0 subsample)

Then could you try to edit the profiles.xml like this :
viewtopic.php?f=7&t=11161#p72226

Then that could be fine to enable detailed logging to see how serviio deliver this file.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Tue Jun 25, 2013 2:02 pm

Re: Automatic Resize of large photos

I tried the 4:2:0 setting and unfortunately to no avail (edit then server restart).

So looking from the logs underneath, it looks as though it is choosing "JPEG_MED" which is then failing to display for some reason. However if I resize the photo to 1080 vertical lines and save the image, I can open the file on WDTV Live.
Thanks for all the help mate!

The log shows this...
013-06-25 23:04:58,288 DEBUG [ServiioHttpService] Incoming request from /***.***.***.**:*****: GET /resource/54934/MEDIA_ITEM/JPEG_MED-0/MEDIUM HTTP/1.0, headers = [Host: ***.***.***.**:****,Content-Length: 0,transferMode.dlna.org: Interactive,User-Agent: INTEL_NMPR/2.1 DLNADOC/1.50 dma/3.0 alphanetworks]]
2013-06-25 23:04:58,289 DEBUG [RendererDAOImpl] Reading a Renderer with ip address ***.***.***.**
2013-06-25 23:04:58,289 DEBUG [RendererDAOImpl] Reading a Renderer with ip address ***.***.***.**
2013-06-25 23:04:58,289 DEBUG [ResourceDeliveryProcessor] Resource request accepted. Using client 'Identifier=***.***.***.**, Profile=WDTV Live'
2013-06-25 23:04:58,290 DEBUG [ResourceDeliveryProcessor] Request for resource 54934 and type 'MEDIA_ITEM' received
2013-06-25 23:04:58,290 DEBUG [MediaResourceRetrievalStrategy] Getting information about media item 54934 (local)
2013-06-25 23:04:58,290 DEBUG [MediaItemDAOImpl] Reading a MediaItem (id = 54934)
2013-06-25 23:04:58,290 DEBUG [ImageDAOImpl] Reading an Image (id = 54934)
2013-06-25 23:04:58,290 DEBUG [ImageDeliveryEngine] Retrieving resource information for item 54934, format JPEG_MED and profile WDTV Live
2013-06-25 23:04:58,290 DEBUG [ImageDeliveryEngine] Getting media info for transcoded version of file DSC00933.JPG
2013-06-25 23:04:58,290 DEBUG [MediaResourceRetrievalStrategy] Getting information about media item 54934 (local)
2013-06-25 23:04:58,290 DEBUG [MediaItemDAOImpl] Reading a MediaItem (id = 54934)
2013-06-25 23:04:58,290 DEBUG [ImageDAOImpl] Reading an Image (id = 54934)
2013-06-25 23:04:58,291 DEBUG [ImageDeliveryEngine] Delivering item '54934' for client 'Identifier=***.***.***.**, Profile=WDTV Live'
2013-06-25 23:04:58,291 DEBUG [ImageDeliveryEngine] Delivering file 'DSC00933.JPG' using transcoding
2013-06-25 23:04:58,291 DEBUG [ImageDeliveryEngine] Retrieving transcoded version of file DSC00933.JPG using format profile JPEG_MED
2013-06-25 23:04:58,291 DEBUG [TranscodingCache] Retrieving media item 54934 with profile JPEG_MED from cache
2013-06-25 23:04:58,291 DEBUG [GETMethodProcessor] Stream entity has length: 135764
2013-06-25 23:04:58,291 DEBUG [ResourceTransportRequestHandler] HTTP/1.1 200 OK, headers = [[Content-Type: image/jpeg,Content-Length: 135764,Date: Tue, 25 Jun 2013 13:04:58 GMT,Server: Linux, UPnP/1.0 DLNADOC/1.50, Serviio/1.2.1,Cache-control: no-cache,transferMode.dlna.org: Interactive,realTimeInfo.dlna.org: DLNA.ORG_TLAG=*]]
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jun 25, 2013 2:50 pm

Re: Automatic Resize of large photos

DanglingPointer wrote:Edit then server restart).

Not only server but all serviio service. Or reboot the PC.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Tue Jun 25, 2013 4:11 pm

Re: Automatic Resize of large photos

Yes the service was shut down. No serviio related java runtime processes running. Then serviio.sh and her console equivalent started up again. Verified from system monitor monitoring all processes.

After the above restart of the server, the YUV setting of 4:2:0 did not work and the dimensions were coming up incorrectly. Log file showed "JPEG_MED" being selected.

Interestingly I tried opening the original 4096x3072 picture folder on my Toshiba Regza DLNA TV and it could not even go into the folder and thumbnail the files. It could however render all the resized duplicates.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jun 25, 2013 5:23 pm

Re: Automatic Resize of large photos

Zip, do you have some more ideas ?

I just notice that you are on Ubuntu system.
Are you sure that serviio is well installed, for example, does "dcraw" package is installed.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Wed Jun 26, 2013 3:37 am

Re: Automatic Resize of large photos

Illico, thanks once again for your time helping!

I'm pretty sure I included that but will check when I get home.

In the meantime, is it possible at all to apply some sort of config logic on the profile to automatically resize to 1080 height for images of a certain size; or better yet to always resize to 1080?

Looking at the bright side, my resized duplicates are working and people around the house can see their pictures on all their devices; the only caveat is that they are duplicates taking extra space with the original images not viewable outside of a pc.
<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Wed Jun 26, 2013 2:13 pm

Re: Automatic Resize of large photos

Hi Illico,

Just got time to check now, dcraw package is indeed present, version "8.99-1 build 1"

So going back to my question from my last post, is it possible just to resize to 1080 height?
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Wed Jun 26, 2013 2:58 pm

Re: Automatic Resize of large photos

DanglingPointer wrote:So going back to my question from my last post, is it possible just to resize to 1080 height?

NO.
Need some developpement.

Zip, do you have any ideas ?
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

DanglingPointer

Serviio newbie

Posts: 18

Joined: Wed Jun 19, 2013 4:53 am

Post Sun Jun 30, 2013 4:24 pm

Re: Automatic Resize of large photos

Any chance of this happening on a later version?

Return to Transcoding

Who is online

Users browsing this forum: No registered users and 26 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.