Differences
This shows you the differences between two versions of the page.
| codingtips [2026/09/23 00:05] – created - external edit 127.0.0.1 | codingtips [2026/09/29 22:18] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Coding Tips ====== | ||
| - | |||
| - | ===== C ===== | ||
| - | ==== How to hide a temporary file ==== | ||
| - | This works because the filename and data are stored separately. The filename can be unlinked, and the data will only be released once the file stream is closed. < | ||
| - | FILE *fd = fopen(" | ||
| - | unlink(" | ||
| - | fprintf(fd," | ||
| - | ... | ||
| - | fclose(fd); | ||
| - | </ | ||
| - | |||
| - | ===== ffmpeg ===== | ||
| - | ==== Create video from image ==== | ||
| - | < | ||
| - | % ffmpeg -loop_input -i image.jpg -r 29.97 -t 10 -qscale 2 video.mpg | ||
| - | </ | ||
| - | ==== Combine audio and video ==== | ||
| - | < | ||
| - | % ffmpeg -i sound.mp3 -i video.avi final.avi | ||
| - | </ | ||
| - | ==== Cut scene from dvr-ms file ==== | ||
| - | < | ||
| - | % ffmpeg -y -ss 1250 -t 81 -i input.dvr-ms -vcodec copy -acodec copy -f dvd out.mpg | ||
| - | % ffmpeg -sameq -i out.mpg final.mp4 | ||
| - | </ | ||
| - | ==== Convert '' | ||
| - | < | ||
| - | % ffmpeg -i input_video.mkv -target ntsc-dvd -acodec mp2 -ab 192 -ac 2 -ar 48000 -b 4096 -r 29.97 -s 720x480 -vcodec mpeg2video -y output_video.mpg | ||
| - | </ | ||