I am constantly impressed by ffmpeg and it capabilities. Last week I was able to make it act as a proxy for live streaming video that reduced the volume of ad-breaks by 50% automatically by listening for SCTE35 cue packets in the stream and adjusting a volume filter accordingly. My housemate has a reality TV addiction, and the ads were getting on my nerves. I just intended to see if it was possible, but I had a POC running in about 1/2 an hour.
A neat subtitle feature I found out mpv has, but no other video player: Hide those parts of the subtitle which are mainly for those with impaired hearing like '[loud noise]' etc, but keep the rest:
`mpv --sub-filter-sdh ...` That logic could probably be extracted into a separate subtitle filtering tool.
When going through Miami Vice I discovered that the SDH parts sometimes also act as notes for the culture-impaired. (Song titles and lyrics were a particularly nice touch, though not strictly SDH.)
And for English-as-second-language folks, it's occasionally curious which expressions are used in the SDH descriptions.
I used an online stream source; A HLS stream that one of my local TV stations broadcasts online.
My method will only work with streams that have SCTE35 packets embedded. This is normally used for local ad insertion on cable networks, so it may not always be available on OTA streams. There is not much code because it is mostly ffmpeg that does the work. I used nodejs to manage an ffmpeg child process, read its output streams (one stream over a unix domain socket for the video, and the stdout stream for the SCTE35 packets) and pipe them to a HTTP client. My code parses the SCTE packets and then sends commands into the running ffmpeg child process to change the audio levels. I am happy to share it when I get home in a few hours.
Comments (124) 31 threads
Show all comments
Showing thread 2 of 31
I am constantly impressed by ffmpeg and it capabilities.
Last week I was able to make it act as a proxy for live streaming video that reduced the volume of ad-breaks by 50% automatically by listening for SCTE35 cue packets in the stream and adjusting a volume filter accordingly.
My housemate has a reality TV addiction, and the ads were getting on my nerves. I just intended to see if it was possible, but I had a POC running in about 1/2 an hour.
`mpv --sub-filter-sdh ...`
That logic could probably be extracted into a separate subtitle filtering tool.
And for English-as-second-language folks, it's occasionally curious which expressions are used in the SDH descriptions.
Is there chance you could open source the code?
My method will only work with streams that have SCTE35 packets embedded. This is normally used for local ad insertion on cable networks, so it may not always be available on OTA streams.
There is not much code because it is mostly ffmpeg that does the work.
I used nodejs to manage an ffmpeg child process, read its output streams (one stream over a unix domain socket for the video, and the stdout stream for the SCTE35 packets) and pipe them to a HTTP client.
My code parses the SCTE packets and then sends commands into the running ffmpeg child process to change the audio levels.
I am happy to share it when I get home in a few hours.
Continue this thread — 1 reply
Keep in mind it's PoC code, I stopped when it worked the first time :P