Millisecond Forums

Playing a video

https://forums.millisecond.com/Topic13268.aspx

By alix762 - 5/13/2014

Hello,

I want to have a page where it just plays a video and when the video is over it skips to the next page.

What is the code for this? What I have tried does not work at all.

<trial vid>
/ stimulusframes = [1=video1]
/ validresponse = (" ")
</trial>

<video vid>
/ items = vid
/ playthrough = true
/ select = sequence
</video>

<item vid>
/ 1 = "video1.mp4"
</item>

<block myblock>
/ trials = [1=vid]
</block>

By Dave - 5/13/2014

<trial vid>
/ stimulusframes = [1=video1]
/ validresponse = (" ")
</trial>

needs to read

<trial vid>
/ stimulusframes = [1=vid]
/ validresponse = (noresponse)
/ timeout = 1
</trial>
By alix762 - 5/13/2014

It's still not working, the video is in the folder yet - it says:

Inquisit Media Error: Cannot play back the file: the format is not supported. line 67: file .\MediaPlayerControl.cpp

Unable to the load media file 'C:\Users\lpzab2\Desktop\Final Inquisit\video1.mp4'. Verify that the file exists and is of a supported format.

Unable to the load media file 'C:\Users\lpzab2\Desktop\Final Inquisit\video1.mp4'. Verify that the file exists and is of a supported format.

By Dave - 5/13/2014

As the error message says, there is an issue with the video file's format. You need to make sure that your system has a proper DirectShow codec available to render the file or convert it to a different format.
By alix762 - 5/13/2014

OK what can I convert it to and how do I do that?
Thanks.
By Dave - 5/13/2014

Depends on your system, what you intend to do (i.e. your use case) and the software you have available. You can find detailed instructions re. video conversion online via your preferred search engine. Online video converters are available as well.
By alix762 - 5/13/2014

I just want a short simple video to play. I thought MP4 was the main video user. I have no idea what else to convert it to that Inquisit will recognise? Shall I just pick something random?
By Dave - 5/13/2014

> I thought MP4 was the main video user.

MP4 is a *container format*, it tells you nothing about how the contents (video and audio data) are actually encoded. Cf. https://en.wikipedia.org/wiki/MPEG-4_Part_14

Your system is lacking proper codecs that Inquisit can use to render the file.

Inquisit will gladly recognise any format for which your system provides proper codecs. A good default choice for Windows boxes is WMV.
By alix762 - 5/13/2014

I converted it to another container format and its still producing the same messages.

How do I get my system to have proper codecs that inquisit can render? I am using WMV
By Dave - 5/13/2014

You can try installing a popular codec pack such as K-Lite (codecguide.com). WMV is *not* a container format (https://en.wikipedia.org/wiki/Windows_Media_Video).
By alix762 - 5/13/2014

Thank you! I have it working now. Is there any way to adjust the size of the video in inquisit? So as to make it bigger and therefore more visible?

Thanks.
By Dave - 5/13/2014

The <video> element has a /size attribute, just like any other stimulus element. Specify it as desired.
By StarxNtheCity - 6/1/2015

I am getting the exact same error message as indicated in this thread, but we're getting it EITHER in Windows OR MAC depending on the video format.  Since we want to create an web experiment we need a format that would work both on Windows AND Mac, and in order to address this we have been trying to create an Include element script that would either chose .mov format for Mac and .wmv for windows but it is not working.

This is what we tried to do. Please help us, we are very sad. 

<include>
/ precondition=[computer.platform == "windows"] 
/ file= "buffy1_wmv"
</include>

<trial buffy1_wmv>
/ stimulusframes = [1= buffyvid]
/ timeout = 5000
</trial>

<trial buffy1_mov>
/ stimulusframes = [1= buffyvid]
/ timeout = 5000
</trial>

<video buffyvid_mov>
/ items = ("buffy1.mov")
/ playthrough = true
/ position = (50, 50 )
</video>

<video buffyvid_wmv>
/items = ("buffy1.wmv")
/playthrough = true
/position = (50, 50)
</video> 

<include>
/ precondition=[computer.platform == "mac"] 
/ file="buffy1_mov"
</include>
By Dave - 6/1/2015

(1) Conditional <include> elements are only available as of Inquisit 4. I am pointing this out because you posted in the Inquisit 3 forum. There are no conditional <include>s in Inquisit 3.

(2) Your /precondition in one of the <include> elements is wrong:

/ precondition=[computer.platform == "windows"]

 ought to read

/ precondition=[computer.platform == "win"]

(3) Beyond (2), the usage of <include> is also wrong. You don't use it to "include" the video file directly. You use it to include a text file containing proper Inquisit syntax that references the correct video file. See this example for proper usage:

https://www.millisecond.com/forums/FindPost9931.aspx

(4) If you want a video format that works for both platforms, encode your videos as MPEG-2.
By StarxNtheCity - 6/8/2015

Thank you so much for the response !

The script now works perfectly but  the .wmv video format is still not working on windows.
The .mov format works perfectly on Mac instead.
Do you think that this might be due to the fact that I have converted and .mp4 format into a .wmv thorough a Mac platform and maybe with an imporper codec?
 You might need to know that our experiment is an on line experiment also.
Than you so much for helping us with this.
By Dave - 6/8/2015

> [...] the .wmv video format is still not working on windows. [...]
> Do you think that this might be due to the fact that I have converted and .mp4 format into a .wmv thorough a Mac platform and
> maybe with an improper codec?

That's a plausible hypothesis, but without any elaboration re. what exactly "not working on windows" means (i.e. what error messages, etc. are there?) I cannot tell.
By StarxNtheCity - 6/9/2015

First, thank you for all your help thus far.

These are the error messages: 
Inquisit Media Error: Cannot play back the file: the format is not supported. line 74: file win\MediaPlayerControl.cpp
Unable to the load media file 'C:/Users/IPSRuser/AppData/Local/Temp/buffy1.wmv'. Verify the file is of a supported video format.
Unable to the load media file 'C:/Users/IPSRuser/AppData/Local/Temp/buffy1.wmv'. Verify the file is of a supported video format.
By Dave - 6/9/2015

Thanks for providing the error messages. Your initial guess is likely correct then: This is indicates a codec issue (or the files have been damaged otherwise during the transcoding process). Try re-encoding the files using either a different / lower version of the WMV codec or using a different codec altogether (MPEG2 is a decent choice for compatibility).