codingtips

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

codingtips [2026/09/23 00:05] – created - external edit 127.0.0.1codingtips [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. <verbatim> 
-FILE *fd = fopen("hidden.file","w"); 
-unlink("hidden.file"); 
-fprintf(fd,"This is hidden information\n"); 
-... 
-fclose(fd); 
-</verbatim> 
- 
-===== ffmpeg ===== 
-==== Create video from image ==== 
- <verbatim> 
-% ffmpeg -loop_input -i image.jpg -r 29.97 -t 10 -qscale 2 video.mpg 
-</verbatim> Where ''-t'' is the duration in seconds  
-==== Combine audio and video ==== 
- <verbatim> 
-% ffmpeg -i sound.mp3 -i video.avi final.avi 
-</verbatim>  
-==== Cut scene from dvr-ms file ==== 
- <verbatim> 
-% 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 
-</verbatim> Where ''-ss'' is start time in seconds, ''-t'' is duration in seconds 
-==== Convert ''mkv'' to ''mpg'' file ==== 
-<verbatim> 
-% 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 
-</verbatim>