Skip to content

ffmpeg cheat sheet

Josvth edited this page Jun 1, 2019 · 6 revisions

DVB-S2 related

Check webcam output formats

ffmpeg -f v4l2 -list_formats all -i /dev/video0

Prepare a MPEG TS to be send in GNU Radio DVB-S2 modulator (16APSK)

ffmpeg -i test.ts -c copy \
     -mpegts_original_network_id 0x1122 \
     -mpegts_transport_stream_id 0x3344 \
     -mpegts_service_id 0x5566 \
     -mpegts_pmt_start_pid 0x1500 \
     -mpegts_start_pid 0x150 \
     -metadata service_provider="Some provider" \
     -metadata service_name="Some Channel" \
     -muxrate 17498k \
     stream.ts

Capture live webcam video and stream it through GNU Radio

Use the following command to setup the stream to a regular TS file:

ffmpeg -f v4l2 -thread_queue_size 200 -framerate 30 -video_size 640x480 -i /dev/video0 -codec:v  mpeg2video -pix_fmt yuv420p -qscale:v 2 -b:v 10M -maxrate 10M -minrate 10M -bufsize 2M -muxrate 17498k -f mpegts test.ts

Then use the prepare MPEG TS command to copy test.ts TS to stream.ts fifo.

Notes (1-June-2018)

  1. 640x480p30 is the maximum I have tested stable so far using the Logitech C270 webcam
  2. Higher resolutions likely require compression (maybe 576p is possible but I haven't tested it yet)
  3. 720p definitely needs compression, works but laggy image and lots of frame drops.
  4. The TS bitrate for 16APSK is limited to 17.8269 Mbps according to http://www.satbroadcasts.com/DVB-S_Bitrate_and_Bandwidth_Calculator.html, I currently use 17498k.

Update: Apparently you can grab direct MJPEG from this specific camera. Using this statement below gave me the best results for 720p30. It still needs to be converter to mpeg (hence the mpeg2video converter).

ffmpeg -f v4l2 -input_format mjpeg -i /dev/video0 -c:v mpeg2video -pix_fmt yuv420p -qscale:v 2 -b:v 15M -maxrate 15M -minrate 15M -bufsize 2M -f mpegts test.ts

This all should be easier with the RPi camera as it can do raw H.264 endcoding.

ToDo:

  • currently with 5ksyms/s, 16APSK, 0.35 rolloff I can achieve 17498kbit/s. I should check if the link budgets closes for these modulations.