Resource icon

All Versions How to convert FLVs to MP4 fast without re-encoding

dodgepong

Administrator
Forum Admin
dodgepong submitted a new resource:

How to convert FLVs to MP4 fast without re-encoding - Record your videos safely and convert them to a more common format

A lot of streamers like to save a local copy of the video they stream out in order to edit it later, upload it to YouTube, or just keep an archive. Usually, this means saving the video as an MP4 in your Broadcast settings. However, we know that OBS is beta software, and streaming is a complicated, resource-intensive process, and sometimes things crash. If you're recording an MP4, and OBS crashes before the MP4 can finish saving, it will be corrupted. FLVs, however, don't have this problem,...

Read more about this resource...
 

faariwasi

New Member
can i get it to auto start when i stream because having to start the stream then start the replay buffer is annoying. i did try to set them as the same hot key but it doesn't work
 

Masaqueen

New Member
can also make a batch file that reads


Code:
@echo off
:start
set ffpath="*pathhere*\ffmpeg.exe"
set outpath="*outpathhere*\%~n1-output.mp4"
if not exist %outpath% (
%ffpath% -i "%~f1" -c copy -copyts %outpath%
)
shift
if not [%1]==[] GOTO start

Only thing you have to do is put the path to ffmpeg.exe where it says *pathhere*

This will allow you drag and drop all your FLV files onto it without having to type a command for each one.


line by line comments
@ Echo Off makes things look cleaner
set ffpath=*pathhere* is where you'd put the path to ffmpeg.exe
set outpath="*outpathhere*\%~n1.mp4" where you want your mp4s
:start is start of loop
%ffpath% -i %1 -c copy -copyts "%~n1-output.mp4" your command but changed to allows for drag and drop, -output just in case something has the exact same name, better safe than sorry.
shift shifts the input files by one
if not [%1]==[] GOTO start checks if input is empty and if it isn't it goes back to start

Edit: Now using koala's superior set path and command.
Edit2: Added out path and skipping existing files.
Edit3: Fixed a silly bug where converting more than one file at the same time would only output the first one.
 
Last edited:

koala

Active Member
I made a similar batch file that simply converts every *.flv in the current directory to *.mp4. It skips *.flv files, if a corresponding *.mp4 already exists:

Code:
@echo off

set ffmpeg="D:\Programme\ffmpeg\bin\ffmpeg.exe"

for %%f in (*.flv) do (
  echo "%%f"
  if not exist "%%~dpnf.mp4" (
    %ffmpeg% -i "%%f" -vcodec copy -acodec copy -copyts "%%~dpnf.mp4"
    if not errorlevel 1 (
      echo ok
    )
  )
)
 

bilehazard

Member
I havent tested this, but how much of the quality will suffer by converting from flv to mp4? Id be interested in this as well since alot of my MP4 recordings get corrupted and kinda annoying.
 

ball2hi

Member
can also make a batch file that reads


Code:
@echo off
set ffpath=*pathhere*
:start
"%ffpath%/ffmpeg" -i "%~f1" -c copy -copyts "%~n1.mp4"
shift
if not [%1]==[] GOTO start

Only thing you have to do is put the path to ffmpeg.exe where it says *pathhere*

This will allow you drag and drop all your FLV files onto it without having to type a command for each one.


line by line comments
@echo off makes things look cleaner
set ffpath=*pathhere* is where you'd put the path to ffmpeg.exe
:start is start of loop
ffmpeg -i %1 -c copy -copyts "%~n1-output.mp4" your command but changed to allows for drag and drop, -output just in case something has the exact same name, better safe than sorry.
shift shifts the input files by one
if not [%1]==[] GOTO start checks if input is empty and if it isn't it goes back to start
This method isn't working me. Nothing is happening. This is what I made...
Code:
@echo off

set ffpath="D:\Stream Applications\Video Archive\Streamed\FFmpeg\bin"

:start

"%ffpath%/ffmpeg" -i "%~f1" -c copy -copyts "%~n1.mp4"

shift

if not [%1]==[] GOTO start
but dragging and dropping isn't working.
 

Masaqueen

New Member
Ah, i didn't think about that, using koala's smarter method of setting the whole path in set fixes this. Problem is the double quotes from path and the command leading to ""D:\Stream Applications\Video Archive\Streamed\FFmpeg\bin"/ffmpeg" when running in your situation. Can fix by removing the quotes in your path or changing it to the new version I edited in.
 

ball2hi

Member
Ah, i didn't think about that, using koala's smarter method of setting the whole path in set fixes this. Problem is the double quotes from path and the command leading to ""D:\Stream Applications\Video Archive\Streamed\FFmpeg\bin"/ffmpeg" when running in your situation. Can fix by removing the quotes in your path or changing it to the new version I edited in.
It worked. Do you think there is a way to tell it though to put the output into a specific directory? Like, if I want to make a directory full of the MP4s... it'd copy it over into there automatically.
 

dodgepong

Administrator
Forum Admin
It already can with FFmpeg output, though native MP4 recording will be added in the next release as well.
 

Roboserg

Member
It already can with FFmpeg output, though native MP4 recording will be added in the next release as well.

Does FFmpeg produce compressed x264 video? Since I dont know that, my previous question was about standard x264 compressed output and whether or not it will save the video as mp4, rather then flv.
 

learningxp

New Member
I'm unable to drag and drop .FLVs onto the program. I must be an idiot because after thirty minutes of Googling, I cannot find an answer. I'm running Windows 8.1 and running FLV Extract with administrative privileges.
 

kamild_

Member
I'm unable to drag and drop .FLVs onto the program. I must be an idiot because after thirty minutes of Googling, I cannot find an answer. I'm running Windows 8.1 and running FLV Extract with administrative privileges.
Sometimes starting apps with administrative privileges causes drag & drop to stop working, launch the application as a normal user instead.
 

Ferris

New Member
I'm actually having a problem with using FLVExract. Every time I click Start, I'm given the error message, "The program can't start because MSVCR100.dll is missing from your computer.
 

storrm

Member
Thanks for this. I have a related question. Once you have converted the flv to mp4, how do you cut out a section from the middle of the resulting file? I've been using FFmpeg to do the conversion with no issue, but trying to cut out a section from the middle of a long stream ends up with audio sync issues. I don't have problems on non-converted mp4 files, so is this method of converting flv to mp4 losing some audio sync information somewhere?

*EDIT* - fixed. if you cut the flv before converting to mp4, there's no issues :-) e.g.

ffmpeg -ss 00:01:00 -i video.flv -to 00:02:00 -c copy cut.mp4

will cut 2mins of video starting at the 1min mark and save it to mp4. Take notice of where seek (-ss) is placed. if you use it after specifying the input (ffmpeg -i video.flv -ss 00:01:00 -to 00:02:00 -c copy cut.mp4) you will get 1min of video BUT you are likely to see audio sync issues. Don't ask me why, but doing the seek first and then extracting x mins of video keeps the audio in sync.
 
Last edited:
Top