I want to convert an elementary stream(.264) to container format(.mp4). Can someone please help me on this? How can I use ffmpeg to do this task? What are all the other methods that could accomplish the same task?
This is easy with
ffmpeg -framerate 24 -i input.264 -c copy output.mp4
This simply stream copies (re-muxes) the video so there is no unnecessary re-encoding occurring; therefore the quality is preserved and the whole process is quick.
Frame rate is by default assumed to be 25. You can change this with the
-framerateinput option. Typical values are
24, or frame rate aliases such as
I wrote a simple bash script to convert all the files in a directory. Make sure the directory only contains the source files since the operation will run on all files in a given directory.
touch ./convert chmod +x ./convert
#!/bin/bash for f in *; do if [ -f "$f" ] && [ "$f" != "convert" ]; then ffmpeg -framerate 25 -i "$f" -c copy "$f.mp4" fi done
Drop in a directory with only the source files, double click and choose run
This script assumes ffmpeg is set up on you system. Not sure which libs are needed, this is what I installed before running: sudo apt install ffmpeg x264 x265 h264enc mencoder mplayer
Only run it once