I am downloading youtube streams containing US news nightly for viewing in daytime (CET).
The videos are in 1 hour sections as mp4 files.
This is all automated in scripts on my Ubuntu server using ffmpeg and youtube-dl.
Now I am looking for a way to detect the presence of the news channel logo inside the video as start-end time pairs in seconds.
I know where on the video screen it is located and also what the logo looks like.
But I have searched unsuccessfully for a way to use ffmpeg or ffprobe to accomplish it.
The closest I have come is in this thread on stackoverflow
I have tested the command on one of my files like this:
and it seems to detect the transitions into and out of commercials using the black detect, but it also detects such transitions within the commercial section and duplicates all output as shown in this small output section:Code:ffprobe -f lavfi -i "movie=myvideo.mp4,blackdetect[out0]" -show_entries tags=lavfi.black_start,lavfi.black_end -of default=nw=1 -v quiet
So this means I cannot use it to filter away the commercials.Code:TAG:lavfi.black_start=55.533 TAG:lavfi.black_start=55.533 TAG:lavfi.black_end=57.833 TAG:lavfi.black_end=57.833 TAG:lavfi.black_start=778.467 TAG:lavfi.black_start=778.467 TAG:lavfi.black_end=779.067 TAG:lavfi.black_end=779.067 TAG:lavfi.black_start=839.033 TAG:lavfi.black_start=839.033 TAG:lavfi.black_end=839.067 TAG:lavfi.black_end=839.067
Instead I need a command that will look for the specific logo which is present when the video is not a commercial.
Can this be done and if so how?
+ Reply to Thread
Results 1 to 13 of 13
-
-
I cannot see how that would help me make ffmpeg or ffprobe find the locations in the video file where the logo is present on screen...
It seems like what you linked to is a way to extract the logo itself from an image or video, but that is not what I am after at all.
What I need is the starting and ending time of all occurrences where the specific logo is on screen.
The logo is always in a specific rectangle on the screen, so it can be defined as percentage of the w and h size of the video. (position x,y and size w,h)
BTW:
I have now noted that at least MSNBC has different colored logos in different parts of the video, they seem to change it now and then while the video plays...
How can one handle that?
I attach an example showing 3 variations of the MSNBC logo. -
did find this - https://answers.opencv.org/question/179798/video-processing-to-detect-a-logo-in-frames/
not sure if this will help or not. -
Some discussions along these lines using AviSynth (Windows only) and VapourSynth (Windows and Linux):
https://forum.videohelp.com/threads/403141-How-to-use-AviSynth-to-find-duplicate-video-clips -
It is possible, although I'm not sure if its exactly what you want. Cut out a picture of your logo and then use Blackframe to find 100% image in cropped video.
I used your image as a reference (186X130) and overlayed it on a videofrom frame 100 to 200 at location 10:10:
[Attachment 61071 - Click to enlarge]
Then I used the logo (change for your purposes)
[Attachment 61072 - Click to enlarge]
Use FFmpeg to search for 100 % for same image in the cropped area of the video where the logo resides. In my case it was 185x130 and I placed it at 10:10 of the video.
Then use ffmpeg:
Code:ffmpeg -i C:\Users\Bud\Desktop\854_480_test_Overlay.mp4 -loop 1 -i C:\Users\Bud\Desktop\MSNBC.jpg -an -filter_complex crop=186:130:10:10,"blend=difference:shortest=1,blackframe=100:60" -f null - 2> text.txt
The Text.txt file will have the usual ffm peg junk and then the lines with 100 % match (Frames 100 -200)
Metadata:
encoder : Lavc58.93.100 wrapped_avframe
[Parsed_blackframe_2 @ 0747fec0] frame:100 pblack:100 pts:3333330 t:3.333330 type:P last_keyframe:0
[Parsed_blackframe_2 @ 0747fec0] frame:101 pblack:100 pts:3366663 t:3.366663 type:B last_keyframe:0
[Parsed_blackframe_2 @ 0747fec0] frame:102 pblack:100 pts:3399997 t:3.399997 type:B last_keyframe:0
~
~
[Parsed_blackframe_2 @ 0747fec0] frame:198 pblack:100 pts:6599993 t:6.599993 type:P last_keyframe:0
[Parsed_blackframe_2 @ 0747fec0] frame:199 pblack:100 pts:6633327 t:6.633327 type:B last_keyframe:0
[Parsed_blackframe_2 @ 0747fec0] frame:200 pblack:100 pts:6666660 t:6.666660 type:B last_keyframe:0
frame= 603 fps=0.0 q=-0.0 Lsize=N/A time=00:00:20.09 bitrate=N/A speed=47.7x
video:240kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown -
[QUOTE=BosseB;2633000] Not exactly what you need, but something similar: https://forum.doom9.org/showthread.php?t=176860
You would need to mod stuff from there to your specific task. -
-
If you are talking about a rolling news channel it will operate off an .m3u8 (poss .mpd if its dash) and the commercial breaks can be commented out by editing the m3u8 in notepad or NPP.
-
I do not understand...
How can one edit videos in Notepad (on Windows I presume)?
These files are on Linux and they are about 200 MB in size each (in mp4 format).
I download them using ffmpeg on the m3u8 stream.
But editing videos using a text editor like Notepad or Notepad++ .................. ??????? -
He's suggesting you edit the playlist file before downloading the video -- so ads aren't included in your downloaded video.
-
What playlist file?
The videos are downloaded using ffmpeg and previously using youtube-dl to mp4 files in a directory which I then play using Kodi while navigating "Files".
The download uses the URL to the stream, originally a youtube URL but now an m32u8.
I have no idea what you mean by "playlist file"... -
m3u8 files are playlists. They are text files with a list of all the segments that comprise the video.
https://en.wikipedia.org/wiki/M3U#M3U8
ffmpeg (or other downloader) reads the m3u8 file then downloads and concatenates all the listed segments.
Similar Threads
-
how can add logo image to MeGUI with custom parameters
By enable in forum EditingReplies: 7Last Post: 1st Feb 2022, 08:38 -
Detect the Resolution of a Streaming Video?
By vega69-ux in forum Video Streaming DownloadingReplies: 2Last Post: 26th Sep 2020, 16:51 -
is there any software who can detect if a video is optimal?
By ujang in forum Newbie / General discussionsReplies: 3Last Post: 3rd Jun 2018, 08:35 -
Adding image or small logo
By killerteengohan in forum RestorationReplies: 4Last Post: 10th Mar 2018, 22:35 -
Is there any way to detect if the MOOV atom is at the start of the video?
By ProxyCell in forum Video ConversionReplies: 4Last Post: 27th Feb 2018, 00:44