VideoHelp Forum
+ Reply to Thread
Results 1 to 15 of 15
Thread
  1. hi, sorry for my bad english,
    i quite desperate about this software,
    i have spent about 2-hour studying and the result is somehow disappointing,

    1. i try in cmd :
    Code:
    "c:\ffmpeg.exe" -i C:\input\test.mp4 -f segment %03d.mp4
    it works, but the output somehow located at "C:\Users\my_user_name"
    2. then i try to make it bat file with the same command, the result is
    Code:
    C:\>-i C:\input\test.mp4 -f segment "C:\test.bat"%03d.mp4 1>"c:\ffmpeg.exe"
    Access is denied.
    
    C:\>pause
    Press any key to continue . . .
    what do i wrong?
    3 i try to make output folder from point no 1
    Code:
    "c:\ffmpeg.exe" -i C:\input\test.mp4 -f segment c:\output\%03d.mp4
    the result is
    Code:
    	Failed to open segment 'c:\output\000.mp4'
    	Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
    	Error initializing output stream 0:0 --
    please, someone, help me, how to make it work for (drag and drop) batch processing,
    or at least how to set output folder = input folder
    additional note: i forgot the location i download the ffmpeg,
    but this is the name file "ffmpeg-20190411-ce92ee4-win64-static.zip",
    then extract it to c:\ drive
    Quote Quote  
  2. Something like:

    Code:
    ffmpeg.exe -i %1 -f segment "%~dpn1.%%03d.mp4"
    will put the output files in the same folder as the input file. input.mp4 will become input.000.mp4, input.001.mp4, etc. Drag/drop onto the batch file.
    Quote Quote  
  3. This script converts all the mp4 files in a folder to mkv, you can change settings and also work with x265

    Code:
    for %%a in ("*.mp4") do ffmpeg  -i "%%a" -preset veryslow -tune film  -crf 20 -profile high  -level 31 -g 30 -r 30000/1001 -flags +ilme+ildct -pix_fmt yuv420p -filter_complex scale=interl=1,fieldorder=tff,setsar=sar=40/33 -refs 10  -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -acodec copy -s 720x408 -aspect 16:9  "%%~na.x264.veryslow.20.Level.31.mkv"
    exit
    Quote Quote  
  4. Originally Posted by jagabo View Post
    Something like:

    Code:
    ffmpeg.exe -i %1 -f segment "%~dpn1.%%03d.mp4"
    will put the output files in the same folder as the input file. input.mp4 will become input.000.mp4, input.001.mp4, etc. Drag/drop onto the batch file.
    thank you so much,
    you dont know how desperate i am to discover this code,
    it works flawlessly,
    sorry about late reply, and thanks again
    Quote Quote  
  5. Originally Posted by mindphasar View Post
    This script converts all the mp4 files in a folder to mkv, you can change settings and also work with x265

    Code:
    for %%a in ("*.mp4") do ffmpeg  -i "%%a" -preset veryslow -tune film  -crf 20 -profile high  -level 31 -g 30 -r 30000/1001 -flags +ilme+ildct -pix_fmt yuv420p -filter_complex scale=interl=1,fieldorder=tff,setsar=sar=40/33 -refs 10  -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -acodec copy -s 720x408 -aspect 16:9  "%%~na.x264.veryslow.20.Level.31.mkv"
    exit
    thanks for reply,
    to be honest, the parameter is too much,
    i can't digest what the idea what you like to show
    Quote Quote  
  6. Originally Posted by jagabo View Post
    Something like:

    Code:
    ffmpeg.exe -i %1 -f segment "%~dpn1.%%03d.mp4"
    will put the output files in the same folder as the input file. input.mp4 will become input.000.mp4, input.001.mp4, etc. Drag/drop onto the batch file.
    sorry about an additional question,
    but how to make output file is create a new folder called "output" in the input file location?
    Quote Quote  
  7. Originally Posted by ujang View Post
    Originally Posted by jagabo View Post
    Something like:

    Code:
    ffmpeg.exe -i %1 -f segment "%~dpn1.%%03d.mp4"
    will put the output files in the same folder as the input file. input.mp4 will become input.000.mp4, input.001.mp4, etc. Drag/drop onto the batch file.
    sorry about an additional question,
    but how to make output file is create a new folder called "output" in the input file location?
    I don't think ffmpeg can create the folder so use md to create it before ffmpeg:
    Code:
    md output
    ffmpeg.exe -i %1 -f segment "%~dp1output\%~n1.%%03d.mp4"
    Quote Quote  
  8. Originally Posted by jagabo View Post
    Originally Posted by ujang View Post
    Originally Posted by jagabo View Post
    Something like:

    Code:
    ffmpeg.exe -i %1 -f segment "%~dpn1.%%03d.mp4"
    will put the output files in the same folder as the input file. input.mp4 will become input.000.mp4, input.001.mp4, etc. Drag/drop onto the batch file.
    sorry about an additional question,
    but how to make output file is create a new folder called "output" in the input file location?
    I don't think ffmpeg can create the folder so use md to create it before ffmpeg:
    Code:
    md output
    ffmpeg.exe -i %1 -f segment "%~dp1output\%~n1.%%03d.mp4"
    thanks for the reply,
    turn out ffmpeg do not support creating new folder,
    you have help me twice today,
    thanks again
    Quote Quote  
  9. Originally Posted by ujang View Post
    Originally Posted by mindphasar View Post
    This script converts all the mp4 files in a folder to mkv, you can change settings and also work with x265

    Code:
    for %%a in ("*.mp4") do ffmpeg  -i "%%a" -preset veryslow -tune film  -crf 20 -profile high  -level 31 -g 30 -r 30000/1001 -flags +ilme+ildct -pix_fmt yuv420p -filter_complex scale=interl=1,fieldorder=tff,setsar=sar=40/33 -refs 10  -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -acodec copy -s 720x408 -aspect 16:9  "%%~na.x264.veryslow.20.Level.31.mkv"
    exit
    thanks for reply,
    to be honest, the parameter is too much,
    i can't digest what the idea what you like to show
    to follow the example on the ffmpeg website

    http://ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment
    Quote Quote  
  10. By the way, you can remux into segments very quickly and with no loss of quality:

    Code:
    md "%~dp1output"
    ffmpeg.exe -i %1 -codec copy -f segment "%~dp1output\%~n1.%%03d.mp4"
    Of course, the codecs must be compatible with the MP4 container.

    You can specify the duration of the segments with segment_time (in seconds):

    Code:
    md "%~dp1output"
    ffmpeg.exe -i %1 -codec copy -f segment -segment_time 60 "%~dp1output\%~n1.%%03d.mp4"
    That will create ~60 second segments.
    Last edited by jagabo; 13th Apr 2019 at 11:51.
    Quote Quote  
  11. Originally Posted by jagabo View Post
    By the way, you can remux into segments very quickly and with no loss of quality:

    Code:
    md "%~dp1output"
    ffmpeg.exe -i %1 -codec copy -f segment "%~dp1output\%~n1.%%03d.mp4"
    Of course, the codecs must be compatible with the MP4 container.

    You can specify the duration of the segments with segment_time (in seconds):

    Code:
    md "%~dp1output"
    ffmpeg.exe -i %1 -codec copy -f segment -segment_time 60 "%~dp1output\%~n1.%%03d.mp4"
    That will create ~60 second segments.
    thank for the reply,
    what mean 60 second segments?,
    is there every 60 second a video will split?
    for -codec copy i will not using it,
    i have some short video compilation,
    and need precise cut,
    if i using copy, the cut will have some remaining(or remainer?) of other scenes
    any way this is my code,
    Code:
    :parse
    IF "%~1"=="" GOTO endparse
    call :handle_one_file %1
    SHIFT
    GOTO parse
    :endparse
    
    :handle_one_file
    cd %CD%
    md output
    md failed
    TITLE "%~dpn1"
    "c:\ffmpeg.exe" -i "%~1" -f segment "%~dp1output\%~n1.%%03d.mp4"
    if not exist "%~dp1output\%~n1.001%~x1" goto skip_delete
    del /q "%~1"
    TITLE delete
    :skip_delete
    move "%~dpn1" "%~dp1failed\"
    i learn it from you in other post, hi hi hi
    Quote Quote  
  12. Originally Posted by ujang View Post
    what mean 60 second segments?,
    is there every 60 second a video will split?
    Yes. But it won't be exactly 60 seconds. The splits will be at the first keyframe after 60 seconds (or whatever interval you specify).

    Originally Posted by ujang View Post
    and need precise cut
    Then you'll have to reencode.
    Quote Quote  
  13. Originally Posted by jagabo View Post
    Originally Posted by ujang View Post
    what mean 60 second segments?,
    is there every 60 second a video will split?
    Yes. But it won't be exactly 60 seconds. The splits will be at the first keyframe after 60 seconds (or whatever interval you specify).

    Originally Posted by ujang View Post
    and need precise cut
    Then you'll have to reencode.
    the video that i split, the duration is sometime under 4 seconds per scene,
    sp the 60 seconds segment is not require,
    anyway, i am very happy with the batch,
    thank for your support
    Quote Quote  
  14. Originally Posted by ujang View Post
    the video that i split, the duration is sometime under 4 seconds per scene,
    sp the 60 seconds segment is not require,
    I just used 60 seconds as an example. I didn't know if you were aware of the segment_time parameter. The default is 2 seconds.
    Quote Quote  
  15. Originally Posted by jagabo View Post
    Originally Posted by ujang View Post
    the video that i split, the duration is sometime under 4 seconds per scene,
    sp the 60 seconds segment is not require,
    I just used 60 seconds as an example. I didn't know if you were aware of the segment_time parameter. The default is 2 seconds.
    owh, thanks for the info
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!