Nikon D3200 ViewFinder / LiveView Support

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Nikon D3200 ViewFinder / LiveView Support

Miguel Ángel García-2
Hi,

I’m working with gphoto2 on a Raspberry Pi B to control a Nikon D3200. I’ve been trying to use a program that implements libgphoto2 with Python and GTK, and has support for displaying a preview stream: https://github.com/jcupitt/rtiacquire

However, I’ve not been able to display the preview and I’m wondering if it had something to do with libgphoto2’s support for the Nikon D3200, or if it’s simply that this particular camera model does not support such function.

The rtiacquire program outputs the following on the command line when trying to get the preview: 

ERROR:root:error - gp_port_usb_close [libusb.c:322]: Invalid parameters: 'port && port->pl->dh' is NULL/FALSE.
ERROR:root:error - foreach_func [gphoto2-port-info-list.c:237]: Error during assembling of port list: 'Unspecified error' (-1).
ERROR:root:error - gp_port_usb_close [libusb.c:322]: Invalid parameters: 'port && port->pl->dh' is NULL/FALSE.
ERROR:root:error - ptp_usb_getresp [usb.c:427]: PTP_OC 0x90ca receiving resp failed: PTP Operation Not Supported (0x2005)
ERROR:root:error - fixup_cached_deviceinfo [library.c:388]: 'ptp_nikon_get_vendorpropcodes (&camera->pl->params, &xprops, &xsize)' failed: PTP Operation Not Supported (0x2005)
ERROR:root:error - _get_Nikon_ViewFinder [config.c:5265]: 'ptp_getdevicepropvalue (params, PTP_DPC_NIKON_LiveViewStatus, &value, PTP_DTC_UINT8) != PTP_RC_OK' failed: (null) (0x0000)

Is there any hack I could apply to make add support for LiveView?

Any help is appreciated.

Thanks in advance 
Miguel

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-user
Reply | Threaded
Open this post in threaded view
|

Re: Nikon D3200 ViewFinder / LiveView Support

Marcus Meissner-4
On Sat, Dec 20, 2014 at 10:31:41PM -0600, Miguel Ángel García wrote:

> Hi,
>
> I’m working with gphoto2 on a Raspberry Pi B to control a Nikon D3200. I’ve been trying to use a program that implements libgphoto2 with Python and GTK, and has support for displaying a preview stream: https://github.com/jcupitt/rtiacquire <https://github.com/jcupitt/rtiacquire>
>
> However, I’ve not been able to display the preview and I’m wondering if it had something to do with libgphoto2’s support for the Nikon D3200, or if it’s simply that this particular camera model does not support such function.
>
> The rtiacquire program outputs the following on the command line when trying to get the preview:
>
> > ERROR:root:error - gp_port_usb_close [libusb.c:322]: Invalid parameters: 'port && port->pl->dh' is NULL/FALSE.
> > ERROR:root:error - foreach_func [gphoto2-port-info-list.c:237]: Error during assembling of port list: 'Unspecified error' (-1).
> > ERROR:root:error - gp_port_usb_close [libusb.c:322]: Invalid parameters: 'port && port->pl->dh' is NULL/FALSE.
> > ERROR:root:error - ptp_usb_getresp [usb.c:427]: PTP_OC 0x90ca receiving resp failed: PTP Operation Not Supported (0x2005)
> > ERROR:root:error - fixup_cached_deviceinfo [library.c:388]: 'ptp_nikon_get_vendorpropcodes (&camera->pl->params, &xprops, &xsize)' failed: PTP Operation Not Supported (0x2005)
> > ERROR:root:error - _get_Nikon_ViewFinder [config.c:5265]: 'ptp_getdevicepropvalue (params, PTP_DPC_NIKON_LiveViewStatus, &value, PTP_DTC_UINT8) != PTP_RC_OK' failed: (null) (0x0000)
>
>
> Is there any hack I could apply to make add support for LiveView?

Can you try 2.5.6 which I released today?

I added these kind of enhancements for the Nikon D3xxx series.

Ciao, Marcus

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Gphoto-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-user
Reply | Threaded
Open this post in threaded view
|

Re: Nikon D3200 ViewFinder / LiveView Support

Jorge Carrillo
In reply to this post by Miguel Ángel García-2
Hi, here's a program that captures live view images on my Nikon D3300. Perhaps it will work on the D3200.

import ctypes
import sys
import time

gp = ctypes.CDLL('libgphoto2.so')

GP_OK = fileNbr = 0
GP_VERSION_VERBOSE = 1

cam = ctypes.c_void_p()
gp.gp_camera_new(ctypes.byref(cam))
ctx = gp.gp_context_new()
fil = ctypes.c_void_p()
gp.gp_file_new(ctypes.byref(fil))

def check(rtn):
    if rtn != GP_OK:
        gp.gp_result_as_string.restype = ctypes.c_char_p
        print '!! ERROR(%s) %s' % (rtn,gp.gp_result_as_string(rtn))
        sys.exit(0)

while True:
    check(gp.gp_camera_init(cam, ctx))
    print '** camera connected'
    end_time = time.time() + 5.
    cnt = 0
    totLen = 0
    cur_time = 0.
    while cur_time < end_time:
        cnt+=1
        check(gp.gp_camera_capture_preview(cam, fil, ctx))
#        print '** gp_camera_capture_preview'
        cData = ctypes.c_void_p()
        cLen = ctypes.c_ulong()
        check(gp.gp_file_get_data_and_size(fil, ctypes.byref(cData), ctypes.byref(cLen)))
#        print '** gp_file_get_data_and_size'
        img = ctypes.string_at(cData.value, cLen.value)
        fileNbr +=1
        open('img/img%s.jpg' % fileNbr,'wb').write(img)
#        print '** image #%s' % fileNbr
        totLen+= cLen.value
        cur_time = time.time()
    print 'total frames = %s, time = %s, average size = %s' % (cnt, (cur_time - end_time) + 5, totLen / cnt)
    check(gp.gp_camera_exit(cam, ctx))
    print '** gp_camera_exit'
    print 'Press ^C to stop, Enter to repeat'
    try:
        x = raw_input()
    except KeyboardInterrupt:
        break
check(gp.gp_camera_unref(cam))
print '** gp_camera_unref'
Reply | Threaded
Open this post in threaded view
|

Re: Nikon D3200 ViewFinder / LiveView Support

derosiat2
Jorge,

That script appears to have worked on my Raspberry Pi with a Nikon D5100. I'm super new so it took me a second to figure out I had to add an img directory in the directory I was running the script from, but after I did it captured 150 jpgs then mercifully asked me if I wanted to stop.

total frames = 150, time = 5.03, average size = 33021
** gp_camera_exit
Press ^C to stop, Enter to repeat

Sorry to hijack here, but what would be the most efficient way to capture an image at the end? I could import os and then send the command  "gphoto2 --capture-image-and-download --filename whatever.jpg" (not that I know exactly what that would look like, but I can probably figure it out), but is there a better way?

Thank you for the script!

-James
Reply | Threaded
Open this post in threaded view
|

Re: Nikon D3200 ViewFinder / LiveView Support

shruti22
In reply to this post by Miguel Ángel García-2
Hii..
The same problem is happen to me before 6 months ago,then I take help of Nikon D3200 Manual. After using tips listed in manual my camera start working perfectly. I also recommend you to please visit on given manual and follow all guideline to fix your problem. I hope this manual would be helpful to you.
Good Luck