Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Main version 2.6 / Re: batch processing with variable video codec
« Last post by dosdan on December 03, 2018, 04:18:47 AM »
Here's a batchfile that, only if the original media file contains AC3, I've updated to copy the video steam and convert the audio stream from AC3 to AAC. I normally work with MP4 files from my camcorders. The only time I work with AC3 is when I set the camera to output AVCHD MTS files.The video streams in both container formats from these cameras is AVC. The AVCHD MTS files have either 2 (256kbps) or 5.1 channel AC3 (384kbps) and a subtitle stream (primitive date/time overlay). I've hardly every used AVCHD with these cameras.

Usage (one or more files): FIND_CONVERT AC3_TO_AAC  *.mp4  *.mts  Dancing.mts  d:\videos\test.mp4  "file has a space in the name.mts"

FIND_CONVERT AC3_TO_AAC.BAT
Code: [Select]
@echo off
cls
for %%F in (%*) do (
  if not exist "%%~dpFconverted\" md "%%~dpFconverted\"
ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "%%~dpnxF" | find "ac3">nul && ffmpeg -i "%%~dpnxF" -hide_banner -v error -y -c:v copy -c:a aac -b:a 256k "%%~dpFconverted\%%~nF.mp4" && echo The AC3 stream in "%%~dpnxF" was converted to 256K AAC and the new MP4 placed in "%%~dpFconverted"
shift
)
pause

The converted files are placed in a "converted" sub-directory below the original file(s) location. (Created if it does not exist.)

The original files in either MTS, M2TS or MP4 containers are recreated in the "converted" sub-directory. The output container format is MP4.

AAC is currently 256kbps. This should be OK for 2ch AC3. You could increase it to 384kbps (-b:a 384k) for 6ch (aka 5.1ch). There is no checking of the bitrate or channel count in the AC3.  6ch AC3 -> 6chl AAC inside the output MP4. I think this is non-standard usage and the MP4 may not play in normal MP4 players. There is no attempt to downmix from 6ch AC3 -> 2ch AAC. This will be possible, but I don't record 6ch AVCHD so I haven't bothered.

I tried to include the subtitle stream from the MTS (-c:s copy). This was not copied. It may be the PGS format used in the camcorder or trying to put it into an MP4 container. I don't convert downloaded movies so I normally don't work with subtitiles.

The convertor automatically overwrites the MP4 in "converted" if it already exists. Remove the "-y" switch from FFMPEG if you want to be prompted first.

Here is the test output display for a run using Find_Convert_AC3_to_AAC.bat  *.mts  "\test2\fred's clip.mts"

Code: [Select]
The AC3 stream in "D:\00000.MTS" was converted to 256K AAC and the new MP4 placed in "D:\converted"
The AC3 stream in "D:\Dancing.MTS" was converted to 256K AAC and the new MP4 placed in "D:\converted"
The AC3 stream in "D:\fred's clip.mts" was converted to 256K AAC and the new MP4 placed in "D:\converted"
The AC3 stream in "D:\test2\fred's clip.mts" was coverted to 256K AAC and the new MP4 placed in "D:\test2\converted"
Press any key to continue . . .

If you wanted, you could have it so that all output MP4s, regardless of their current directory, go into the same "converted" directory. (That's not normally the way I work.)

Dan.
22
Windows / Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Last post by dosdan on December 02, 2018, 09:17:11 PM »
Any idea how to make it work with directories that contain other files than video ? It fails when I have folders with text files in it :/

If running the batchfile from the cmd line in the current directory, specify the filetypes you want by nominating one or more wildcards+file extensions e.g.

Find_AC3.bat *.mp4 *.mts



If operating by drag-and-drop from the Windows desktop, open the directory first and sort the icons (or details) by filetype. (For this type of work you really should select the Windows option that will not hide known file extensions in a directory listing - hiding them is only useful for novices.) Select a block of media files, say all the MP4s, using the standard Windows L.click (start of block) & Shift-L.Click (end of block) and then drag the selected group onto the Find_AC3.bat icon.

Dan.

23
Windows / Re: Newbie : How to Copy Video & Audio folder from MKV to MP4 Script
« Last post by seyar on December 02, 2018, 12:23:46 PM »
Thanks @dosdan !

Any idea how to make it work with directories that contain other files than video ? It fails when I have folders with text files in it :/
24
Main version 2.6 / Re: batch processing with variable video codec
« Last post by dosdan on December 01, 2018, 10:05:58 PM »
I worked out the detection side of this. This batchfile will show you only the flies containing AC3 audio streams in one or more directories.  In the example the files were a mixture of MTS and MP4s.

https://avidemux.org/smif/index.php/topic,18268.msg83705.html#msg83705

It would be easier, and less clunky, to do the whole test-for-AC3-and-convert outside ADM, using a batchfile running FIND (part of Windows/DOS), FFPROBE & FFMPEG.

Dan.
25
Main version 2.6 / batch processing with variable video codec
« Last post by seyar on December 01, 2018, 10:19:37 AM »
Hi guys,

I have a few video I would like to convert in batch from AC3 to AAC, without modifying the video codec.

Any idea how to do this ? Ideally I would just point to the folder and the script would detect if the audio is AC3 or not, if yes -> convert audio only.

Thanks for any help !

Kind Regards,
Alexandre
26
Take it for granted that the video starts with an IDR (in Avidemux called I-frame or keyframe), followed by a P-frame – in the stream order. However, the display order may be very different. B-frames, decoded after but displayed before the first IDR are not shown by Avidemux (the video playback starts always at the presentation time of the first IDR), but cannot be safely dropped because they may be referenced by later frames in the stream.

I guess, "hidden" early B-frames of the appended video would become visible in Avidemux as their PTS in the linear time are greater than the PTS of the very first keyframe of the first video. Or they should become visible after saving the resulting video in copy mode at the latest.

In the scripting shell of Avidemux,

Code: [Select]
ed = Editor()
for frame in range(0,20):
    ed.printTiming(frame)

would print the timing and type of the first 20 frames in the stream order to admlog.txt.
27
Main version 2.6 / Avidemux 2.7.1 Nightly (Win64): Discarding starting B frames?
« Last post by Steps on December 01, 2018, 12:29:46 AM »
Videos of my camera (Canon PowerShot G7X) do for some reason start with 2 B-frames instead of an I-frame.

If I open up a video, select the first I-frame and delete everything before that and save the new video I
can see with ffprobe that the B frames still remain.

How can I get rid of those?
Is Avidemux not seeing these frames?

My problem is that I want to join some MP4 files, but maybe I want to trim them later.
This becomes a problem when the B-frames at the end of the first video and the beginning of the second video merge.
So I would loose frames on that cut.

On a sidenote: Does anybody know why my camera videos do not start with a I-frame? This seems to be wrong.
28
Windows / Re: Please help explain audio synch (shift)
« Last post by aussie43 on November 30, 2018, 10:33:31 PM »
I found that when I do just audio shift, MediaInfo shows the correct delay.
But when I also do conversions at the same time, then it shows wrong information. 
Doesn't matter, the main thing is that it is in synch as far as I can observe.
29
Okay, thank you for your explaination.
30
This has been explained numerous times. It is not a bug, it is by design. FFmpeg uses a signed value (int64_t) to store timestamps while Avidemux uses an unsigned value (uint64_t), so that PTS have to be delayed as DTS can't go negative if B-frames are present. If a container specifies that audio playback should be advanced, all video timestamps have to be delayed furthermore to account for that.

Some real bugs regarding calculation of video delay in mp4 and mpegts have been fixed since 2.7.1, you are far better off using the latest nightly.
Pages: 1 2 [3] 4 5 ... 10