⬆️ ⬇️

UPD. Demon video conversion to FLV.

This is a continuation, or rather development, of an article written earlier .



As a result of a small refactoring, it turned out to improve performance and simplify the code. The result was a change in the list of used software.

1. The preview is now not cut by mplaer, but by the ffmpegthumbnailer utility, which can cut a frame by the offset specified in percent of the total length of the clip. No need to somehow get dilina roller. She also resized the frame, which made it possible to stop using ImageMagik



2. Instead of flvtool2, yamdi is used. This utility is written in C, therefore faster. In addition, it loads less memory, and it has a little more features.

')

Below is a section of code in which the major changes occurred.





.....

#

(echo "Converting $FILE..."

sleep 5s

#

mv ${SRC_DIR}/${FILE} ${TRG_DIR}/${FILE}

#

THUMBNAIL="${USER_FOLDER}/${USER_ID}/video/${VIDEO_ID}.png"

ffmpegthumbnailer -i ${TRG_DIR}/${FILE} -o $THUMBNAIL -s ${THUMBNAIL_WIDTH}

#

mencoder ${TRG_DIR}/${FILE} -o "${TRG_DIR}/${FILE}.${OUTPUT_FORMAT}" ${PARAMS}

#

yamdi -i "${TRG_DIR}/${FILE}.${OUTPUT_FORMAT}" -o "${USER_FOLDER}/${USER_ID}/video/${VIDEO_ID}.${OUTPUT_FORMAT}" -c 'Your comment' -l

#

rm ${TRG_DIR}/${FILE}

rm "${TRG_DIR}/${FILE}.${OUTPUT_FORMAT}"

) &

...

Source: https://habr.com/ru/post/49053/



All Articles