Hi , I am using Hauppauge WinTV and my schedule recordings having the .ts format.
[Attachment 65249 - Click to enlarge]
WinTV has the option by converting all recordings using ffmpeg
by default the ffmpeg command for the conversion of the recorded .ts files to.mp4 is as follows:
-i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset ultrafast -profile:v main -acodec aac "[DEST_FILE].mp4"
[Attachment 65247 - Click to enlarge]
[Attachment 65248 - Click to enlarge]
How to modify the above command in order to set ffmpeg to always converting huge .ts files in size to .mp4 format but the .mp4 file to be much smaller in size?
please advise,
Thanks
+ Reply to Thread
Results 1 to 28 of 28
-
Last edited by neroman00; 7th Jun 2022 at 14:46.
-
File size is directly linked to bitrate. WinTv records (or atleast it does with mine) as mpeg2 @ 6000+ kbps
h264 will typically have lower bitrate so the files will be smaller. But you need to do a conversion to see if the result is satisfactory for you since there are mnay other quality factors making a simple answer to your question not really practical. -
Use clever FFmpeg-GUI.
It's designed for just that purpose. You can, for example, re-encode only the video track (to make it smaller) and mux one or more audio tracks unchanged from the ts file into a new container (e.g. mp4, mkv etc), or you can also change each audio track as you like. -
Thanks!
I've tried it but no option to convert .ts files to .mp4. By default videos conversion encoder is x264 (avc) that gives the result to .mkv output target file. -
The new created videostream is per default enbedded in a mkv container. Mux it with the desired audiostreams to mp4.
[Attachment 65285 - Click to enlarge] -
Changing the preset from ultrafast to veryfast will cut the file size to about 1/2, maybe 1/3. The conversion will take a little longer though. Specifying a higher crf value can make it even smaller (but lower quality). The default is 23.
-i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "[DEST_FILE].mp4" -
Many thanks for your advise!
-i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "[DEST_FILE].mp4"
Any suggestions if is possible to modify the above command by adding a task to auto clear the unnecessary .ts files after the completion of ffmpeg job? Actually this will be useful to save space by keeping only the converted .mp4 files.
Please advise!
Thanks again -
I doubt it. But ther are so many options that, maybe, one exists for this.
Yet, but if you logically think about this, why would you want this ?
Your original source has been converteted. Delete that at first conversion may be fine. But review the conversion even a little while down the road and a complete original may not be available to you. Better to have the original available. You will probably have the avail of direct ffmpeg switches but there are still other options that enable you to experiment since, as I already stated and just to clarify, what may work for one recording may not be optimal for another. -
Sure, just add a second command to the batch file:
Code:ffmpeg -i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "[DEST_FILE].mp4" del "[SOURCE_FILE]"
Code:ffmpeg -i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "[DEST_FILE].mp4" if errorlevel 1 goto DONTDELETE del "[SOURCE_FILE]" goto end :DONTDELETE echo didn't delete :END
Last edited by jagabo; 10th Jun 2022 at 11:49.
-
Hi again,
The following command is working fine:
ffmpeg -i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "[DEST_FILE].mp4"
I added your new batch file command without line brakes in order to be recognized to my software's settings as following:
-i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "[DEST_FILE].mp4" if errorlevel 1 goto DONTDELETE del "[SOURCE_FILE]" goto endONTDELETE echo didn't delete :END
[Attachment 65383 - Click to enlarge]
After this there is not any result!
[Attachment 65382 - Click to enlarge]
Please advise!
Thanks -
Jagabo posted a batch (.bat) file which requires each command to be on a separate line. It appears that WinTv10 has a single line command so that can not be incorporated in to the program
I only use WinTv7 and that actually does have an advance option to delete the original file after conversion. However since it only supports mpeg2.ts to mpeg2.ps I do leave that option ticked.
You could contact user supprt at Hauppauge for them to tell you where that command is stored just to see if it can be externally modified.
Otherwise if you insist on this you would have to do it manually using the .bat file (or another program such as posted earlier - there are many others) except that "[SOURCE_FILE]" and "[DEST_FILE]" would have to be modified because, as it stands, they only apply to the command line in Wintv10 -
Yes, I thought you were using a batch file. It may be possible in your program to change the Auto Convert Tool Location to use C:\Windows\System32\CMD.EXE, then set the Auto Convert Tool Command Line to point to a batch file and provide the filename:
Code:/c c:\batch\convert.bat "[SOURCE_FILE]"
Code:"c:\path\to\ffmpeg.exe" -i "%~dpnx1" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "%~dpn1.mp4" if errorlevel 1 goto DONTDELETE del "%~dpnx1" goto end :DONTDELETE echo didn't delete :END
Last edited by jagabo; 14th Jun 2022 at 07:17.
-
Thanks but unfortunately a (.bat) batch file requires each command to be on a separate line and Auto Convert Tool Command Line DO NOT accepts separate command lines but only a single command line.
-
[Attachment 65464 - Click to enlarge]
Here is the result after i typed on CMD your command cmd /c C:\convert.bat "[SOURCE_FILE]" just to test it. I put the convert.bat batch file under my C drive.
C:\WINDOWS\system32>cmd /c C:\convert.bat "[SOURCE_FILE]"
C:\WINDOWS\system32>"C:\ffmpeg\bin\ffmpeg.exe" -i "C:\Windows\System32\[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "C:\Windows\System32\[SOURCE_FILE].mp4"
ffmpeg version 2021-04-28-git-1ab74bc193-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 0.100 / 59. 0.100
libavformat 59. 0.100 / 59. 0.100
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.100 / 8. 0.100
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
C:\Windows\System32\[SOURCE_FILE]: No such file or directory
C:\WINDOWS\system32>if errorlevel 1 goto DONTDELETE
C:\WINDOWS\system32>echo didn't delete
didn't delete
C:\WINDOWS\system32>Last edited by neroman00; 17th Jun 2022 at 16:39.
-
With the greatest respect to jagabo (who knows more about these things in his left thumb than I do in my whole body) he can not test his suggestion simply because Hauppauge WinTv10 will only work with a Hauppauge capture device.
The error msg suggests that it looks for the "[SOURCE_FILE]" in the system32 folder (and without any reference to the true location and filename) and I would not even begin to suggest you use that to record your videos.
Neither am I inclined to install that for my own Hauppauge device (even if it is supported)
Maybe jagabo can suggest another way but here is my own........
Just how long does it take to manually delete the source after conversion ? There must be a good reason why Hauppauge removed that direct option in later versions of their program. -
Well according to the Hauppauge store I can install WinTv 10 and it should work with my device.
However, since it requires a paid-for activation code this is a non starter for me (obviously you had the program with your device) -
Last edited by neroman00; 19th Jun 2022 at 02:05.
-
Well, it looks like the program is working really hard to stop you from doing what you want.
-
Or it is doing something quite 'simple'
1. Point to the installed version of ffmpeg
2. Use that version to convert the source using the rest of the command line.
(So the two boxes work in tandem. The second one, in particular, will npt respond if it sees switches that ffmpeg does not understand)
From what I read that works. What does not work is to expand the command to do ancilliarly things such as delete the original source. And, as mentioned and for whatever reason, that has been removed.
Stop wasting your time. Use the original (or jagabo's modified) command. And manually delete the source. Or show me a single conversion tool that can delete a source as part of the conversion process.
Oh, yes. You can do it. jagabo's .bat file showed how it can be done. But not as part of the initial recording pricess. So unless that is modified for any .ts file in the appropiate folder surely it is just as simple to manually delete the .ts file after the event. -
I suspect it can be done but you'll have to find a way of tricking the program into doing it.
-
That's true!
Hence, jagabo's (modified) command as follows works fine:
-i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset veryfast -crf 25 -profile:v main -acodec aac "[DEST_FILE].mp4"
I have a minor issue regarding the above command. The outcome aspect radio after the rendered .mp4 file is 4:3 instead of 16:9.
Is there a way to modify the above command to force the aspect ratio (DAR) of the .mp4 files to 16:9 ?
Thanks -
As I suspected, you are not viewing 4:3 but 720*576 (which would have been the original file as well) which, if your player does not respect the DAR flag, which is actually 16:9 in your sample, will display as 5:4 and distorted.
So you must use a player that respects the flag or force playback to 16:9
Similar Threads
-
ffmpeg how modify the contrast with nvidia “hevc_nvenc” codec
By marco000 in forum Video ConversionReplies: 15Last Post: 12th Jun 2021, 12:34 -
Get the complete FFmpeg command line when using FFmpeg Batch Converter
By pascor in forum Newbie / General discussionsReplies: 8Last Post: 13th May 2021, 23:14 -
I'm looking for Hauppauge WinTV PVR-250
By OS_Man in forum Capturing and VCRReplies: 12Last Post: 20th Sep 2020, 12:54 -
Hauppauge WinTV-HVR-1975 - Letterboxed 4:3 Capturing Issue
By DPage in forum Capturing and VCRReplies: 51Last Post: 9th May 2020, 05:36 -
Hauppauge 1196 WinTV HVR-1250 in x64 Windows 10?
By bizzybody in forum Capturing and VCRReplies: 3Last Post: 4th Oct 2017, 03:33