Media Scanner scans only templates
bencius opened this issue · 8 comments
Media scanner scans only templates, no other folders. 2.4.0 version throws error:
[error] Exception: D:\a\sofie-casparcg-server\sofie-casparcg-server\src\protocol\util\http_request.cpp(72): Throw in function struct caspar::http::HTTPResponse __cdecl caspar::http::request(const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)
Hi!
Could you provide your casparcg config file?
Yes! ;)
<configuration> <paths> <media-path>media/</media-path> <log-path>log/</log-path> <data-path>data/</data-path> <template-path>template/</template-path> </paths> <lock-clear-phrase>secret</lock-clear-phrase> <channels> <channel> <video-mode>720p5000</video-mode> <consumers> <screen /> <system-audio /> </consumers> </channel> </channels> <controllers> <tcp> <port>5250</port> <protocol>AMCP</protocol> </tcp> </controllers> <amcp> <media-server> <host>localhost</host> <port>8000</port> </media-server> </amcp> </configuration>
By the way it happens with all scanners versions available for now.
I'm unable to reproduce the issue unfortunately.
Perhaps if you provide some more information, such as:
- Exactly what versions of CasparCG and media-scanner (if different) you're running
- Steps to reproduce (exactly what commands you sent)
- Try with emptying the template & media folders and re-add one file at a time, perhaps the issue is related to a certain file?
I installed 2.4.0 RC2 NRK and also saw the problem where media scanner only reports templates. I also cleared the problem on my installed system
Do a clean install of the server:
- Download the V2.4.0-NRK-RC2 zip file.
- Unzip the above into a newly created folder (eg c:\ccg\server\V2d4d0_NRK_RC2). Do NOT unzip into a folder with a working server install.
- Edit casparcg.config as needed to point to the true locations of the media and template files. Add channels as desired, but a single screen consumer is adequate for the test.
This RC2 release candidate does not include a media scanner module. Add a scanner, for example download media-scanner.zip from https://github.com/nrkno/sofie-casparcg-media-scanner/releases/tag/v1.6.1. Unzip the file and copy scanner.exe and the node_modules folder with all sub folders.
Do NOT use the autostart batch file. Manually start scanner.exe, then start casarcg.exe
Enter command CLS in the Caspar.exe console. It returns a blank.
The problem is the release candidate build does not include the ffmpeg tools required by the scanner. I copied ffmpeg.exe, ffplay.exe and ffprobe.exe from a server 2.3.3_LTS install into the 2.4 RC folder. I restarted the scanner and the server. CLS now returns media information.
I have not yet tested if the media type is correct files, there may still be a problem that video files are incorrectly reported as audio unless they have the video content as the first track.
The next release will be pulling in the latest scanner build from https://github.com/CasparCG/media-scanner/releases, and will also include the needed ffmpeg binaries.
I shall leave this open until there is a release that includes these
@Julusian - Thanks for update about future release including the latest scanner.
Just for your info, the latest scanner release (1.1.0 dated 17th Feb) still has the error where it misallocates the media type on all clips where the video is NOT stream 0. The pull request in scanner issue #41 by m0vse has never been used after the discussions about which method or methods should be used and all stalled some 4 years ago.
The misallocation impacts those using the SVT default client - any affected video files are in the Audio folder.
@Julusian - I have tested a different method of media type determination using the stream type returned by ffprobe, and that a still returns a codec_time_base value of '0/1'. I scan all streams in the file, noting the first instance of each stream type for later data extraction. Each detected stream type is allocated a weighting value: audio=4 video=2 still=1. The weighting values are added with the sum used as the test value in a switch statement that allocates the media type and that extracts timebase for the allocated media type.
This algorith has been tested on Windows 10, and so far all media files have been defined as the expected type. A JS version of the code is at https://github.com/amwtech/casparcg-media-scanner, as your conversion of the code to typescript happened during my testing.
The JS code for the generateCinf is also shown below.
Andy
function generateCinf (doc, json) {
let tb = [0,1]
let dur = parseFloat(json.format.duration) || (1 / 24)
let type = ' AUDIO '
let streamTypes = {aud:0, vid:0, still:0}
let firstAudioStream = -1
let firstVideoStream = -1
for (let stream of json.streams) {
if (stream.codec_type === 'audio') {
streamTypes.aud = 4
if (firstAudioStream < 0) firstAudioStream = stream.index
} else if (stream.codec_type === 'video') {
if (stream.codec_time_base === '0/1') {
streamTypes.still = 1
} else {
streamTypes.vid = 2
if (firstVideoStream < 0) firstVideoStream = stream.index
}
}
}
switch (streamTypes.aud + streamTypes.vid + streamTypes.still) {
case 0:
case 4:
case 5:
type = ' AUDIO '
tb = (json.streams[firstAudioStream].time_base || '1/25').split('/')
break
case 1:
type = ' STILL '
tb = [0,1]
break
case 2:
case 3:
case 6:
case 7:
const fr = String(json.streams[firstVideoStream].avg_frame_rate || json.streams[firstVideoStream].r_frame_rate || '').split('/')
type = ' MOVIE '
if (fr.length ===2) {
tb = [fr[1], fr[0]]
}
break
}
return [
`"${getId(config.paths.media, doc.mediaPath)}"`,
type,
doc.mediaSize,
moment(doc.thumbTime).format('YYYYMMDDHHmmss'),
tb[0] === 0 ? 0 : Math.floor((dur * tb[1]) / tb[0]),
`${tb[0]}/${tb[1]}`
].join(' ') + '\r\n'
}
Fixed by CasparCG/media-scanner#67