How to use FFmpeg to create test input
A useful tool in many situations is FFmpeg. Documentation on using FFmpeg is available at the FFmpeg wiki.
Create an MPEG-TS feed on a port
The following is a recipe for creating an MPEG Transport Stream (TS)
feed on a port, where
<mp4 video file> is the file to be used as a
1$ ffmpeg -nostdin -re -stream_loop -1 -i ~/encoder/data/<mp4 video file> \2 -c copy -f mpegts 'udp://127.0.0.1:1234' > logile.txt 2>&1 &
The above command can be executed in foreground or background.
FFmpeg opens sockets for STDIN, STDOUT, and STDERR by default. If the
STDIN isn't disabled with
-nostdin a background FFmpeg process will
stall on socket reads from STDIN and the video will not display.
Static image with a timecode (counter, not clock)
The following is a recipe for creating a static image video with a
timecode counting up from 00:00:00:00 (HH:MM:SS:FF), where
r is the
<rtmp URL> is the destination URL of the video stream.
1$ ffmpeg -loop 1 -i image.png -vf drawtext="fontfile=/Library/Fonts/Arial.ttf: \2timecode='00\:00\:00\:00': r=30: fontcolor=white: \3fontsize=24: box=1: email@example.com: \4boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2" \5-f flv <rtmp URL>
The "image.png" input in the above argument must be appropriately sized for the video being fed. That is, the dimensions must equal the video resolution.
Larger font sizes may be desired for higher resolutions.
For example, using an image file that is 480 x 720, the result will appear similar to the following at one hour, 10 minutes, 37 seconds, and 9 frames: