Narendhiran P

Narendhiran P

  • NA
  • 147
  • 2.3k

How add webjobs input and output path to the existing storage contain

Jul 8 2020 12:36 PM
The below code i was using video resize using webjobs on my application. I want to configure(use) input and output path on my existing storage image container in Azure to the below code. Please advice. thanks in advance
  1. public static void ProcessQueueMessage(  
  2. [QueueTrigger("blobcopyqueue")] string filename, TextWriter log,  
  3. [Blob("textblobs/{queueTrigger}", FileAccess.Write)] Stream blobOutput  
  4. )  
  5. {  
  6. //set the input file path  
  7. string inputfile = string.Format(@"D:\home\site\wwwroot\video\{0}", filename);  
  8. //set the input file path  
  9. string outputFile = string.Format(@"D:\home\site\wwwroot\video-compress\{0}", filename);  
  10. using (var engine = new Engine(@"D:\home\site\wwwroot\compress\ffmpeg.exe"))  
  11. {  
  12. string command = string.Format(@"-i {0} -vcodec h264 -b:v 250k -acodec mp2 {1}", inputfile, outputFile);  
  13. //you could change the command value as what you want to use  
  14. engine.CustomCommand(command);  
  15. }  
  16. using (var fileStream = System.IO.File.OpenRead(outputFile))  
  17. {  
  18. fileStream.CopyTo(blobOutput);  
  19. }  
  20. }