Skip to content

Instantly share code, notes, and snippets.

@logtheta
Last active May 27, 2019 20:55
Show Gist options
  • Save logtheta/4d6417e41c96b053e0e9e6f640bc02bc to your computer and use it in GitHub Desktop.
Save logtheta/4d6417e41c96b053e0e9e6f640bc02bc to your computer and use it in GitHub Desktop.
ffmpeg_commands.sh
#!/bin/sh
# Crete SMTPE bar video
ffmpeg -f lavfi -i smptebars=duration=10:size=1920x1080:rate=30 smptebars.mp4
# raw h264 from file to HTTP server (in loop)
ffmpeg.exe -stream_loop -1 -re -i <filename>.mp4 -c:v libx264 \
-vprofile baseline -b:v 600k -bufsize 600k -tune zerolatency -pix_fmt yuv420p \
-an \
-f rawvideo \
http://<media_server_ip_address>:<media_server_port>/h264/my_stream
# cut video starting from second 0 and get 300 s
ffmpeg -ss 0 -i video.mp4 -t 300 -c copy video_out.mp4
# Impress SMTPE timecode on mp4 (Windows)
ffmpeg -i video.mp4 -vf "drawtext=fontfile='c\:\\Windows\\Fonts\\arial.ttf': timecode='10\:00\:00\:00': r=30: \x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" \
-an -y \
tc_video.mp4
# Impress SMTPE timecode on mp4 (Ubuntu)
ffmpeg -i video.mp4 -vf "drawtext=fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf': timecode='10\:00\:00\:00': r=30: \x=(w-tw)/2: y=h-(2*lh): fontcolor=white: fontsize=48 : box=1: boxcolor=0x00000000@1" -an -y tc_video.mp4
# Check media metadata
ffprobe -report video.mp4
# Change h264 profile
ffmpeg -i input.mp4 -c:v libx264 -profile:v high -level:v 4.0 -c:a copy output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment