Forgot how to install and use script to rename a video file as jpeg - Script Writing - CHDK Forum

Forgot how to install and use script to rename a video file as jpeg

  • 7 Replies
  • 5990 Views
Advertisements
--[[
@title renaming
]]

new_suffix = "jpg"
file = file_browser("A/DCIM")
file_new = string.sub(file, 1, (string.len(file)-3)) .. new_suffix
print("new:", file_new)
os.rename(file, file_new)

A year ago I was gifted the above script to rename a video file as jpeg so that with my Classic Eye-fi card I could send it as jpeg to my computer via Wi-Fi.  It worked.

But I lost it in reformatting and think I am re-installing it/using it incorrectly.
I copied it to Notepad and saved it as videorename.lua.  I placed it in scripts, selected it in the menu(it turned orange).  I then in the preview mode with the video I wanted renamed clicked the shutter (in capture mode).  the suffix has not changed in the menu.

Is my mistake obvious?

Thanks

*

Offline reyalp

  • ******
  • 14126
Re: Forgot how to install and use script to rename a video file as jpeg
« Reply #1 on: 13 / July / 2013, 18:33:39 »
I placed it in scripts, selected it in the menu(it turned orange).  I then in the preview mode with the video I wanted renamed clicked the shutter (in capture mode).  the suffix has not changed in the menu.
It's not totally clear to me what you did, but it doesn't sound like you are actually running the script.

You need to select the script, using "set" in alt mode or the "script" menu.
After the script is selected, stay in alt mode and press the shutter. This will run the script.
When the script runs, it should open a chdk file browser. Select the video you want to rename.

CHDK doesn't know anything about which video you have selected in Canon's preview UI.
Don't forget what the H stands for.

Re: Forgot how to install and use script to rename a video file as jpeg
« Reply #2 on: 13 / July / 2013, 18:35:27 »
Code: [Select]
--[[
@title renaming
]]

new_suffix = "jpg"
file = file_browser("A/DCIM")
file_new = string.sub(file, 1, (string.len(file)-3)) .. new_suffix
print("new:", file_new)
os.rename(file, file_new)
A year ago I was gifted the above script to rename a video file as jpeg so that with my Classic Eye-fi card I could send it as jpeg to my computer via Wi-Fi.  It worked.

But I lost it in reformatting and think I am re-installing it/using it incorrectly.
I copied it to Notepad and saved it as videorename.lua.  I placed it in scripts, selected it in the menu(it turned orange).  I then in the preview mode with the video I wanted renamed clicked the shutter (in capture mode).  the suffix has not changed in the menu.
The script is fine (just tested it) but your description of what you did is vague.  Once you select the script, you need to exit the CHDK menu but not CHDK <ALT> mode.  Then press the shutter button to actually run the script - you should see a file selection box come up.  Navigate to the file you want to rename and press the Func/Set button.   Done.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Forgot how to install and use script to rename a video file as jpeg
« Reply #3 on: 14 / July / 2013, 05:56:13 »
When I saved the script, it saved in lower case and has a .~ after the name.
To select the script file I pushed the right side of the function wheel; the file name turned orange.
I turned alt off, then on to get a clear screen.
When I click the shutter, at the bottom left of the screenis
***STARTED***
***FINISHED***
renaming
renaming
In the top left in red appears to be
uBASIC:1: Urik slnt
(Not sure of characters)

The name has not changed but now in chdk mode all videos have renaming showing at the bottom left even when I have not selected the menu.
John

Re: Forgot how to install and use script to rename a video file as jpeg
« Reply #4 on: 14 / July / 2013, 11:03:15 »
When I saved the script, it saved in lower case and has a .~ after the name.
What program are you using to save the script?  The tilde (~) is usually reserved for backup files.  The filename should be just as you stated above - videorename.lua  - any other file extension or characters than .lua will not work.

Quote
To select the script file I pushed the right side of the function wheel; the file name turned orange.
I turned alt off, then on to get a clear screen.
Hmmm .. you don't need to press the right side of the function wheel.  Depending on what you do next, that might not even work.   You need to press the center Func/Set button to select the script.

Quote
When I click the shutter, at the bottom left of the screen is
***STARTED***
***FINISHED***
renaming
renaming
In the top left in red appears to be
uBASIC:1: Urik slnt
(Not sure of characters)
There's your biggest problem.  Because of how you named the file (above),  CHDK tries to run the program as a uBASIC file.   But its Lua code.   Go back and save the file with the correct file name.

Update : you may run into another problem, depending on what program you used on your PC to create the file.  It has to be a simple "text only" file - UTF-8 - with no built-in formatting.  Using notepad.exe on a PC is a good idea - I think the Mac has something equivalent.  Or you could just download the attached file - its the right format so save to your SD card without opening it.
« Last Edit: 14 / July / 2013, 11:06:49 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Forgot how to install and use script to rename a video file as jpeg
« Reply #5 on: 14 / July / 2013, 12:21:42 »
I used your download and conversion took place.  Thanks. Automatically Eye-fi transferred a jpeg labelled file to my computer.

But the file was only 4k.  I remember this problem from before, but can't remember how I solved it >:(

I tried also shooting a much smaller compact format (4 meg file) wondering if size was the problem.  Same result- a correctly labelled as jpeg 4k  file moves via Wi-Fi.

I also tried a freshly re-charged battery (at least 75% according file viewer in chdk).  no difference.

The new jpeg named file is still correct size in the camera- 4 meg.

I realize you expertise is chdk not eye-fi.

Maybe sleeping on it, to quote Meatloaf.
John

Re: Forgot how to install and use script to rename a video file as jpeg
« Reply #6 on: 14 / July / 2013, 13:14:13 »
I realize you expertise is chdk not eye-fi.
I keep thinking I should grab a eye-fi card the next time woot has them on sale.  I think there are a couple of generations out there now - not sure of the differences.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Forgot how to install and use script to rename a video file as jpeg
« Reply #7 on: 14 / July / 2013, 13:21:54 »
Re Eye-fi :  since I use the A540 Canon, I cannot use anything newer than SD cards which means normally 2 gig, although I found a source for 4 gig SD cards.
To buy a sd only Eye-fi card would require looking for second hand cards on the internet.


Re my 4k only moving, I have tried rebooting my computer to be sure nothing else is running, using Connectify to boost my Wi-Fi signal, and plugging my camera into the ac outlet so that it runs at full power.

One out of 4 times I got a full file to move, but then it would not convert back after renaming to avi.

Last time last year, it just spontaneously started working after a few days.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal