ffmpeg -i input.mp4 -b 1000000 output.mp4
ffmpeg -i input.m2ts -vcodec libx264 -crf 20 -acodec ac3 -vf "yadif" output.mp4
ffmpeg -i input.mp4 -aq 5 -ac 2 -qmax 25 -threads 2 output.webm
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -b:a 128k -c:a libopus output.webm
ffmpeg -i input.mp4 -aq 5 -ac 2 -qmax 35 -threads 2 output.webm
ffmpeg -i input.mp4 -vcodec libtheora -acodec libvorbis -q:v 6 -q:a 5 output.ogv
ffmpeg -i input.mp4 -vcodec libtheora -acodec libvorbis -q:v 2 -q:a 4 output.ogv
ffmpeg -i foo.m4a -acodec libmp3lame -aq 2 bar.mp3
for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -aq 2 "${f%.m4a}.mp3"; done
find . -name '*.m4a' -exec ffmpeg -i {} -acodec libmp3lame -aq 2 {}.mp3 \;
for /R %f in ("*.m4a") do (ffmpeg.exe -i "%~f" -acodec libmp3lame -aq 2 "%~pf%~nf.mp3")
rm -f ~/audio/files/*.mp3;
rm -f ~/audio/files/*.ogg;
cd ~/audio/files/;
for i in *.wav; do ~/ffmpeg/ffmpeg -y -i $i -af volume=2.5 -ab 192k ${i/%.wav/.mp3}; done;
for i in *.wav; do ~/ffmpeg/ffmpeg -y -i $i -af volume=2.5 -aq 10 ${i/%.wav/.ogg}; done;
ffmpeg -i "https://***.akamaihd.net/i/***/master.m3u8" -c copy input.ts
ffmpeg -i input.ts -c:v libx264 -c:a copy output.mp4
ffmpeg -i input.wav -acodec libmp3lame output.mp3
ffmpeg -i input.wav -vn -ar 44100 -ac 2 -ab 192k -f mp3 output.mp3
ffmpeg -i input.mp3 -ac 1 -ar 8000 -acodec pcm_s16le output.wav
ffmpeg -ss 0 -i input.mp4 -frames:v 1 first.png
ffmpeg -sseof -3 -i input.mp4 -update 1 -q:v 1 last.png
ffmpeg -i input.mp4 -ss 3.5 -c:v libx264 -c:a aac -strict experimental output.mp4
ffmpeg -i input.mp4 -t 10 -c copy output.mp4
ffmpeg -f concat -safe 0 -i <(for f in ./*.mp4; do echo "file '$PWD/$f'"; done) -c copy output.mp4
ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex "[0:v:0][1:v:0]concat=n=2:v=1[outv]" -map "[outv]" -c:v libx264 -preset fast -crf 23 output.mp4
ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex "[0:v:0]scale=1080:1468,setsar=1[v1]; [1:v:0]scale=1080:1468,setsar=1[v2]; [v1][v2]concat=n=2:v=1[outv]" -map "[outv]" -map 0:a:0 -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k output.mp4
@0xrin1
Just tested the command above with the example file
https://filesamples.com/samples/video/m2ts/sample_1280x720_surfing_with_audio.m2ts
and audio is working fine.
Can you please provide the given m2ts file that does not work?
Sorry, false alarm.
The converted files do have sound, I just took the word of the person I sent them to and then when I checked I think my system sound was muted 🤦
Sorry for wasting your time and thanks for the gist, really helpful 🙇
Really nice gist.
Another command that comes in handy is lossless M2TS -> MP4 conversion.
ffmpeg -i input.m2ts -vcodec copy -acodec copy -f mp4 output.mp4
This only changes the container without re-encoding, so it's instant.
I want to convert a Blu-ray video file in m2ts format to mp4 without having to re-encode the video and audio. However, all the commands I have tried so far seem to have some issues. The file is converting quickly and smoothly and appears fine when played. However, if you attempt to skip forward or backward for a split second, it has a glitchy effect on the screen.
I want to convert a Blu-ray video file in m2ts format to mp4 without having to re-encode the video and audio. However, all the commands I have tried so far seem to have some issues. The file is converting quickly and smoothly and appears fine when played. However, if you attempt to skip forward or backward for a split second, it has a glitchy effect on the screen.
just use ffmpeg -i input.m2ts -c copy output.mp4
I want to convert a Blu-ray video file in m2ts format to mp4 without having to re-encode the video and audio. However, all the commands I have tried so far seem to have some issues. The file is converting quickly and smoothly and appears fine when played. However, if you attempt to skip forward or backward for a split second, it has a glitchy effect on the screen.
just use ffmpeg -i input.m2ts -c copy output.mp4
I have tried that one, as well as;
ffmpeg -i input.m2ts -c:v copy -c:a copy output.mp4
ffmpeg -r 29.97 -i input.m2ts -c:v copy -c:a copy output.mp4 (To keep fps same as original)
What I notice is a difference in fps in m2ts and mp4. The input is 29.97 fps and the output is 59.94!
Input : Video: h264 (High) (HDMV / 0x564D4448), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn
Output : Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 13417 kb/s, 59.94 fps, 59.94 tbr, 90k tbn (default)
I don'y understand what is
-b 1000000
format.
ffmpeg documentation is exhaustive, but quite difficult to understand, especially for non fluent englidh people.
My goal is to convert m2ts files in mp4 format, keeping the quality as good as possible.
I always use:
ffmpeg -i input.m2ts output.mp4
I get mp4 files with size 2x smaller than the m2ts file, and sometimes I see some "aliasing" (not sure it's the good word) when the animation of the video goes fast.
So I'm searching the good parameters to have mp4 in good quaity.
In the 2 examples above, which is the best way to my expected result?
Maybe it's others parameters?
Thank you for your advice.
I don'y understand what is
-b 1000000
format. ffmpeg documentation is exhaustive, but quite difficult to understand, especially for non fluent englidh people.
My goal is to convert m2ts files in mp4 format, keeping the quality as good as possible. I always use:
ffmpeg -i input.m2ts output.mp4
I get mp4 files with size 2x smaller than the m2ts file, and sometimes I see some "aliasing" (not sure it's the good word) when the animation of the video goes fast. So I'm searching the good parameters to have mp4 in good quaity. In the 2 examples above, which is the best way to my expected result? Maybe it's others parameters? Thank you for your advice.
I would use "-c:v copy -c:a copy", it will not re-encode the video/audio and will copy them into mp4 container.
ffmpeg -i input.m2ts -c:v copy -c:a copy output.mp4
Most of the time it works for me but I had issues with frame rates before.
ffmpeg -i input.m2ts -c copy output.mp4
But I have issues too with frame rates, and some mp4 (not all) have the aliasing I'm talking about in the first message. I have less when I remove the copy argument, to reencode the video, but it's a pain in the ass when I have multiple videos to convert (it takes time and CPU power).
I don't know if the cause is the convertion, or ffmpeg itself.
Thanks for the confirmation anyway!
Hey the m2ts to mp4 conversion doesn't include the audio.
Any suggestions for what I could try?
In my case,
ffmpeg -i dolbyTest-Win10-Final.m2ts -vcodec libx264 -crf 20 -acodec ac3 -vf "yadif" test.mp4
seems to be working well and it's not messing up the 5.1
Hey the m2ts to mp4 conversion doesn't include the audio.
Any suggestions for what I could try?
In my case,
ffmpeg -i dolbyTest-Win10-Final.m2ts -vcodec libx264 -crf 20 -acodec ac3 -vf "yadif" test.mp4
seems to be working well and it's not messing up the 5.1
Regarding working command above, this new command below is messing up my front/rear panning. It feels like everything is only coming out of the front speakers in test2.webm:
ffmpeg -i test.mp4 -af "channelmap=channel_layout=5.1" test2.webm