Selur's Little Message Board

Full Version: How to run this ffmpeg command lines in hybrid?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
filename="*.mp4"
for i in $filename; do
    echo $i
    if [[ ! -d ./out_mp4 ]];then
        mkdir ./out_mp4
    fi
    pwd
    echo 
    ffmpeg.exe -i "$i" -map 0:v -c:v copy -bsf:v h264_mp4toannexb raw.h264 -y
    ffmpeg.exe -fflags +genpts -r 24 -i raw.h264 -i "$i" -map 0:v -c:v copy -map 1:a -af atempo=0.8 -movflags faststart ./out_mp4/"$i"  -y
    rm raw.h264
done
Hybrid will not use ffmpeg for audio filtering.
Hybrid will not create a 'out_mp4' folder.
That said, it looks like you want to reencode and slow down the first audio stream and pass-through the video while changing its frame rate to 24fps and then create a .mp4-file with faststart enabled.
Passing through the video and setting the fps to 24 can be done by:
  • setting 'Base->Processing->Video' to 'passhtrough'
  • setting 'Muxing->Frame rate' to 24
Reencoding the audio to aac and changing the speed by 0.8 can be done by:
  • setting 'Base->Processing->Audio' to anything but '
  • enabling 'Audio->Base->Audio Encoding Options'
  • settings 'Audio->Base->Audio Encoding Options->Encoder->Audio format' to 'aac'
  • enabling 'Audio->Base->Audio Encoding Options->Filtering->Speed change->decimals->from' to 1
  • enabling 'Audio->Base->Audio Encoding Options->Filtering->Speed change->decimals->to' to 0.8

When using MP4Box, adding faststart requires you to enable 'Config->Containers->Mp4Settings->Interleave'.

Cu Selur
I tried,the output video is slow to  24 FPS,but the audio is still the same. where is the problem?FFmpeg didn't need to reencode,why hybrid needed?
Quote:FFmpeg didn't need to reencode,why hybrid needed?
Your FFmpeg command line call does reencode the audio to the default audio format for mp4 which should be aac.
(FFmpeg audio filters can only be applied when reencoding.)

About the audio speed:
My guess is that your audio queue entry does not contain the filter settings.
Since you didn't share a debug output, I have no clue what you actually did.

Cu Selur
How to speed up / slow down a video – FFmpeg FFmpeg can do this without reencode.
I tried the menthod you gave me again,it works. Here is the debugoutput,click anyone of the red button to download it.Is it possible that hybrid speed up / slow down a video without reencode?Other containers without FFmpeg encode can be accepted. Why video doesn't need to reencode but audio does?
https://wwi.lanzoup.com/iX03h0msu1da
The audio is reencoded, not the video.
'Base->Processing->Video' to 'passhtrough' makes sure there is no reencoding of the video.
None of the examples on the linked page does audio speedup without reencoding.

Quote:Why video doesn't need to reencode but audio does?
Video only needs time code adjustment, which is a container info.
For audio the timing is part of the format, additionally you usually want to modify the audio to not change the pitch. (to not get chipmunk or low voices)

Looking at the debug output, the audio queue entry:
Code:
D:\download\115download\1.mp4;0;aac;2;bitrate;4;FDK;low complexity;44100;0.00;en;-41;1354.025;aac;0;1;don't change;2;false;;false;1;true;1.0000;0.8000;false;false;false;;;true;48000;unknown;aac;;false;true;false;2/0/0;1/1;;0;0;;None;54:_:15;10;20;0;1000;;false;;pcm;false;1;;;;Stereo;2.77;16;-n;4;GPU;NVIDIA CUDA;;2;false;D:\download\115download\1.mp4;true;false;;;false;2;;LC;-1;
looks fine.

Looking at the audio encoding calls:
Code:
"D:\Program Files\Hybrid\64bit\ffmpeg.exe" -y -threads 8 -loglevel fatal -nostdin -i "C:\Users\Administrator\AppData\Local\Temp\iId_1_aid_0_lang_en_DELAY_-41ms_2023-02-07@01_33_24_8210_01.aac" -ac 2 -ar 44100 -f sox - | D:\Program Files\Hybrid\64bit\sox.exe" --multi-threaded --temp "C:\Users\Administrator\AppData\Local\Temp\2023-02-07@01_33_24_821001" --buffer 524288 -S -t sox - -t wav - rate -v 48000 tempo 0.80000000 | "D:\Program Files\Hybrid\64bit\fdkaac.exe" --bitrate-mode 4 --profile 2 --transport-format 0 --gapless-mode 2 --ignorelength -o "C:\Users\Administrator\AppData\Local\Temp\iId_1_aid_0_lang_en_DELAY_-41ms_2023-02-07@01_33_24_8210_02.aac" -
the audio is slowed down through sox 'tempo 0.80000000'.
-> Accodring to the debug output Hybrid is doing what it should.

Cu Selur
Here are audios extracted from slow video and the original audio, and the time picture is displayed by Potplayer. All  slowdown audios don't show the right time exactly compared to the slowdown video time 28 min 12 s. Why? The FFmpeg output slowdown audio file is almost the same size as the original file, so I thought it didn't reencode but just changed time like slowdown video. ffmpeg didn't change the audio bitrate.

https://wwi.lanzoup.com/ioKCK0mswq6f

Whether Hybrid has the same filter like atempo audio filter in FFmpeg?Can it  speed up/slow down any kind of  audio with any kind of containers?


https://trac.ffmpeg.org/wiki/How%20to%20...0a%20video
Sorry, got no time to read up on how ffmpegs filters work. (busy few next days, not much time to do anything aside from work)
Hybrid uses sox for filtering. Maybe instead of 1:0.8 one needs to use 0.8:1. (you can read up on how both filters work if you want to know)
SpeedUp/SlowDown is independent of format and container as long as Hybrid can convert to the format.

Cu Selur
I got some sox command lines to slow down audio, and it didn't need to change the bitrate. 

sox slow.aiff fixed.aiff speed 1.027

Can hybrid SpeedUp/SlowDown audio passthough without changing bitrate just like sox?
Since you are busy, I can wait for the answer until you're free.
That line also does reencode from pcm to pcm,....
Hybrid by default uses 'tempo' instead of 'speed', if you want it to use 'speed', simply enabled 'Adjust pitch' in the audio 'Speed change' settings.
The only way I can think of to change the speed of an audio stream without having to reencode and let the decoder on playback do the job would be to use mkv as container and use mkvs stretch option.
In general, I would not recommend doing that since letting the player on playback so the speed change:
a. will require additional ressources (on playback)
b. will usually be less quality (since it has to be done fast enough for realtime playback)
Also not all players support this, so on some players your video will be broken one way or the other.
Hybrid can do that, but you will have to figure out how to do it on your own, since I won't explain it since it's really not something I would recommend.

Cu Selur
Pages: 1 2 3