Answer the question
In order to leave comments, you need to log in
How to transcode video for mobile device with 1.3x, 1.5x, 2x video/audio acceleration?
At home, on my computer, I watch movies and series through VLC with acceleration from 1.3x to 2.4x. This is very convenient, because viewing takes much less time.
With the advent of my tablet (Android 4), I practically don’t watch videos on my computer, but viewing on a tablet in accelerated mode is not possible (and yes, I tried ALL players from the market). Therefore, the idea arose to convert video / audio on a computer, and then upload it to a tablet for viewing.
Because I'm not strong in video / audio coding, I decided to turn to the respected habra community.
Question. Prompt a program or a set of scripts that meets the following requirements:
1. Console application or GUI program with the ability to run from the console
2. Sound acceleration without noticeable pitch distortion
3. Sound conversion to mono
4. Video acceleration
5. Video and sound compression with conversion to hardware codecs of Android devices 6. And, optionally, re-creation of
the
file with subtitles
the operation can be done on the tablet from the command line.
Before advising anything, please make sure you understand what sound problem I'm talking about - open VLC and speed up the video by 2x - make sure that the voices in the video are not distorted and are perceived the same as without speeding up. Now open any other player and speed it up in it - the voices will be too "squeaky".
Answering obvious questions:
1. Google
2. Offer MEncoder only with a set of scripts for it
3. The most interesting issue is the acceleration of sound
4. I did not find the ability to save the stream with acceleration in the VLC converter
5. VLC for Android does not work under Android 4 (Acer A501), and even in 3m android
,
VLC did not have the option to speed up the video, and even if it had, it would have slowed down a lot They do, but I didn’t manage to automate the conversion process from the command line, although all the programs used in the article can be launched from the console.
Answer the question
In order to leave comments, you need to log in
#!/bin/sh -e
#============================================================================#
# Конвертация видео в группу файлов (в т.ч. ускоренное воспроизведение #
# ускорение производится фиксированно в 1.6 раз #
#============================================================================#
# (C) Denis Smirnov <[email protected]> http://mithraen.ru/ #
#============================================================================#
IN="$1"
if [ ! -f "$IN" ]; then
exit -1
fi
IN=$(realpath "$IN")
dir=$(dirname "$IN")
cd "$dir"
# каталог, куда отправляем результат
outdir=${IN%.*}
mkdir -p $outdir
# делаем копию оригинального файла
ln "$IN" $outdir/original
# извлекаем звук (конвертируя сразу же в wav)
avconv -i "$IN" -vn -y $outdir/in.wav
# извлекаем видео
avconv -i "$IN" -an -y -vcodec copy $outdir/in.mkv
# конвертируем видео в ускоренный вариант и сразу конвертируем в lossless H.264
avconv -i "$outdir"/in.mkv -vf setpts=0.625*PTS -an \
-vcodec libx264 -pre:v lossless_ultrafast \
"$outdir"/fast.mkv
# конвертируем аудио в ускоренный формат
echo "Audio file converting -- tempo"
sox "$outdir"/in.wav "$outdir"/fast.wav tempo 1.6
# конвертируем ускоренное аудио в mp3
sox "$outdir"/fast.wav "$outdir"/fast.mp3
avconv -i "$outdir"/fast.mkv -i "$outdir"/fast.mp3 -acodec copy -vcodec copy "$outdir"/out-fast.mkv
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question