模拟电视噪音 [英] Simulating TV noise

查看:220
本文介绍了模拟电视噪音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经google了一下,但是从来没有找到答案。我的第一种方法是模拟电视屏幕上的视频和音频噪声?我的意思是,当我的电视天线被删除,但电视仍然在(有时在日本恐怖电影中显示)。我可以使用ffmpeg或任何其他技术,但信号的最简单的形式是什么?

解决方案

如何创建视频和音频噪音与 ffmpeg



使用 / dev / urandom / h2>

您可以使用 / dev / urandom 生成视频和音频噪声(Windows用户将不得不使用 geq 过滤器如下所示)。这是一个小小的视频,但当然这个视频不会是一个静态图像:



  ffmpeg -f rawvideo -video_size 1280x720 -pixel_format yuv420p -framerate 25 \ 
-i / dev / urandom -ar 48000 -ac 2 -f s16le -i / dev / urandom -codec:a copy \
-t 5 output.mkv

这将创建彩色视频噪点。如果您只想黑白,您可以添加



根据(视频通用方程)filter(with :



原来和搞砸了我法师。结果是非常动态的,所以单个图像不能完全捕获效果。

  ffmpeg -i输入。 mp4 -codec:v huffyuv -bsf:v noise -codec:a copy noise.mkv 

根据文档



p>该比特流滤波器可以接受一个值来增加或减少噪声量。这是相反的,所以更高的数字是更少的噪音,1是最低的数字,因此噪音最大。您将需要进行实验以查看最适合您的内容。



第一个例子流复制的音频,并且只会视频,但您可以通过删除流说明符将过滤器应用于音频和视频:

  ffmpeg -i input.mp4 -codec:v huffyuv -c:a pcm_s16le -bsf noise = 1000000 noise.mkv 

或为视频和音频提供单独的值:

  ffmpeg -i input.mp4 -codec:v huffyuv -c:a pcm_s16le -bsf:v noise = 1000000 -bsf:a noise = 100 noise.mkv 

这似乎适用于视频的 rawvideo huffyuv pcm_s16le 为音频,但我建议尝试。请参阅无损vs腐败说明),用于显示不同编码器如何对噪音的损坏作出反应。



然后可以重新编码这是一个更便携或通用的格式:

  ffmpeg -i noise.mkv -codec:v libx264 -pix_fmt yuv420p output.mkv 

请参阅 H.264 AAC 编码指南在FFmpeg维基上更多的编码信息。



强制像素格式



你可以骗ffmpeg并让它认为颜色空间和色度子采样是不同的,它实际上是导致奇怪的,类似错误的效果。





原始和搞砸的图像。结果可能非常动态,所以单个图像不能完全捕捉效果。


  1. 探测您的输入。

      ffmpeg -i original.mp4 

    请注意帧速率和视频帧大小。


  2. 请参阅 ffmpeg -pix_fmts 并选择一种可用的格式,如 yuv420p16le


  3. 创建rawvideo将它管理到另一个 ffmpeg 实例:

      ffmpeg -loglevel error -i original.mp4 -f rawvideo  -  | ffmpeg -y -f rawvideo -framerate 25 -video_size 1280x720 -pixel_format yuv420p16le -i  -  -pix_fmt yuv420p video.mp4 

    从控制台输出中显示的原始输入文件信息复制 -framerate -video_size


  4. 如果需要,Mux音频

      ffmpeg -i video.mp4 -i original.mp4 -map 0 -map 1:a -c copy output.mp4 



I have googled a bit but was never able to find an answer. What should be my first approach to simulate a video and audio noise from TV on screen? I mean, when my TV antenna is removed but the TV is still on (like they show in Japanese horror movies sometimes). I can use ffmpeg or any other technique but what is the simplest possible form of the signal?

解决方案

How to create video and audio noise with ffmpeg

Using /dev/urandom

You can use /dev/urandom to generate video and audio noise (Windows users will have to use the geq filter as shown below). This is a small screeenshot, but of course the video will not be a static image:

ffmpeg -f rawvideo -video_size 1280x720 -pixel_format yuv420p -framerate 25 \
-i /dev/urandom -ar 48000 -ac 2 -f s16le -i /dev/urandom -codec:a copy \
-t 5 output.mkv

This will create color video noise. If you just want black and white you can add the hue filter.

ffmpeg -f rawvideo -video_size 1280x720 -pixel_format yuv420p -framerate 25 \
-i /dev/urandom -ar 48000 -ac 2 -f s16le -i /dev/urandom -codec:a copy \
-t 5 -vf hue=s=0 output.mkv

Using the nullsrc video source

According to the documentation:

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis/debugging tools, or as the source for filters which ignore the input data.

Which basically means that it is useful as a "blank canvas" for other filters, such as the background that will be covered up when placing two videos side-by-side, but when used alone it can create odd somewhat random (but sometimes boring) effects:

ffmpeg -f lavfi -i nullsrc=s=1280x720 -t 60 output.mkv

Using filters

Alternatively, the geq (video "generic equation") filter (with nullsrc as its "blank canvas") can create video noise similar to the examples above, and the aevalsrc filter can create white noise audio:

ffmpeg -f lavfi -i nullsrc=s=1280x720 -filter_complex \
"geq=random(1)*255:128:128;aevalsrc=-2+random(0)" \
-t 5 output.mkv

Note that this will create black and white video noise.


Adding random visual noise and errors to an existing video

Using the noise bitstream filter:


Original and screwed up images. The result is very dynamic, so a single image does not fully capture the effect.

ffmpeg -i input.mp4 -codec:v huffyuv -bsf:v noise -codec:a copy noise.mkv

According to the documentation:

A bitstream filter operates on the encoded stream data, and performs bitstream level modifications without performing decoding.

This bitstream filter can accept a value to increase or decrease the amount of noise. It's inverse, so a higher number is less noise, and 1 is the lowest number and therefore the most noise. You will need to experiment to see what works best for you.

This first example stream copied the audio and only glitched the video, but you can apply the filter to both audio and video by removing the stream specifier:

ffmpeg -i input.mp4 -codec:v huffyuv -c:a pcm_s16le -bsf noise=1000000 noise.mkv

Or provide separate values for video and audio:

ffmpeg -i input.mp4 -codec:v huffyuv -c:a pcm_s16le -bsf:v noise=1000000 -bsf:a noise=100 noise.mkv

This seems to work well with rawvideo or huffyuv for video, and pcm_s16le for audio, but I recommend experimenting. See lossless vs corruption (notes) for a video showing how different encoders react to noise corruption.

You can then re-encode this to a more portable or common format:

ffmpeg -i noise.mkv -codec:v libx264 -pix_fmt yuv420p output.mkv

See the H.264 and AAC encoding guides on the FFmpeg Wiki for more encoding info.

Forcing a pixel format

You can lie to ffmpeg and make it think that the colorspace and chroma subsampling is different that it actually is resulting in strange, error-like effects.


Original and screwed up images. The result can be very dynamic, so a single image does not fully capture the effect.

  1. Probe your input.

    ffmpeg -i original.mp4
    

    Note the frame rate and video frame size.

  2. Refer to ffmpeg -pix_fmts and choose one of the available formats such as yuv420p16le.

  3. Create rawvideo and pipe it to another ffmpeg instance:

    ffmpeg -loglevel error -i original.mp4 -f rawvideo - | ffmpeg -y -f rawvideo -framerate 25 -video_size 1280x720 -pixel_format yuv420p16le -i - -pix_fmt yuv420p video.mp4
    

    The -framerate and -video_size values were copied from the original input file information shown in the console output of step 1. Of course you can also manipulate these for various effects.

  4. Mux audio if desired

    ffmpeg -i video.mp4 -i original.mp4 -map 0 -map 1:a -c copy output.mp4
    

这篇关于模拟电视噪音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆