@@ -11,40 +11,52 @@ export async function extractTranscriptFromVideo(videoPath: string): Promise<str
1111 return new Promise ( ( resolve ) => {
1212 try {
1313 console . log ( 'Running Python script to extract audio and transcribe...' )
14+ console . log ( 'Video path:' , videoPath )
1415
1516 const possiblePaths = [
1617 join ( __dirname , '../../../audio_extractor.py' ) ,
1718 join ( process . cwd ( ) , 'audio_extractor.py' ) ,
1819 'audio_extractor.py'
1920 ]
2021
22+ console . log ( 'Possible script paths:' , possiblePaths )
23+
2124 let scriptPath : string | null = null
2225 for ( const path of possiblePaths ) {
2326 if ( existsSync ( path ) ) {
2427 scriptPath = path
28+ console . log ( 'Found script at:' , scriptPath )
2529 break
2630 }
2731 }
2832
2933 if ( ! scriptPath ) {
34+ console . log ( 'No script found, using fallback' )
3035 resolve ( generateFallbackTranscript ( videoPath ) )
3136 return
3237 }
3338
39+ console . log ( 'Spawning Python process with:' , scriptPath , videoPath )
3440 const pythonProcess = spawn ( 'python' , [ scriptPath , videoPath ] )
3541
3642 let stdout = ''
3743 let stderr = ''
3844
3945 pythonProcess . stdout . on ( 'data' , ( data ) => {
4046 stdout += data . toString ( )
47+ console . log ( 'Python stdout:' , data . toString ( ) )
4148 } )
4249
4350 pythonProcess . stderr . on ( 'data' , ( data ) => {
4451 stderr += data . toString ( )
52+ console . log ( 'Python stderr:' , data . toString ( ) )
4553 } )
4654
4755 pythonProcess . on ( 'close' , ( code ) => {
56+ console . log ( 'Python process closed with code:' , code )
57+ console . log ( 'Final stdout:' , stdout )
58+ console . log ( 'Final stderr:' , stderr )
59+
4860 if ( code === 0 ) {
4961 try {
5062 const result : PythonScriptResult = JSON . parse ( stdout )
@@ -54,6 +66,11 @@ export async function extractTranscriptFromVideo(videoPath: string): Promise<str
5466 if ( ! transcript ) {
5567 console . warn ( 'No transcript generated, using fallback' )
5668 transcript = generateFallbackTranscript ( videoPath )
69+ } else {
70+ console . log (
71+ 'Successfully extracted transcript:' ,
72+ transcript . substring ( 0 , 100 ) + '...'
73+ )
5774 }
5875
5976 resolve ( transcript )
0 commit comments